--------------------------------------------------------------------------*/
| 2563 | |
| 2564 | /*--------------------------------------------------------------------------*/ |
| 2565 | static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text, |
| 2566 | size_t length) |
| 2567 | { |
| 2568 | /* Set the token line and column number. */ |
| 2569 | lexer->token.line = lexer->line; |
| 2570 | lexer->token.column = lexer->column; |
| 2571 | |
| 2572 | /* Use the same buffer if possible. */ |
| 2573 | if (lexer->token.text) { |
| 2574 | if (text && length < lexer->size) { |
| 2575 | memcpy(lexer->token.text, text, length); |
| 2576 | lexer->token.length = length; |
| 2577 | return; |
| 2578 | } |
| 2579 | free(lexer->token.text); |
| 2580 | lexer->token.text = 0; |
| 2581 | lexer->size = 0; |
| 2582 | } |
| 2583 | |
| 2584 | /* Need to extend the buffer. */ |
| 2585 | if (length > 0) { |
| 2586 | lexer->token.text = (char*)malloc(length); |
| 2587 | memcpy(lexer->token.text, text, length); |
| 2588 | lexer->token.length = length; |
| 2589 | lexer->size = length; |
| 2590 | } else { |
| 2591 | lexer->token.length = 0; |
| 2592 | } |
| 2593 | } |
| 2594 | |
| 2595 | /*--------------------------------------------------------------------------*/ |
| 2596 | static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text, |
no outgoing calls
no test coverage detected
searching dependent graphs…