--------------------------------------------------------------------------*/
| 2594 | |
| 2595 | /*--------------------------------------------------------------------------*/ |
| 2596 | static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text, |
| 2597 | size_t length) |
| 2598 | { |
| 2599 | char* temp; |
| 2600 | size_t newSize; |
| 2601 | |
| 2602 | /* If the appended text will fit in the buffer, do not reallocate. */ |
| 2603 | newSize = lexer->token.length + length; |
| 2604 | if (lexer->token.text && newSize <= lexer->size) { |
| 2605 | memcpy(lexer->token.text + lexer->token.length, text, length); |
| 2606 | lexer->token.length += length; |
| 2607 | return; |
| 2608 | } |
| 2609 | |
| 2610 | /* We need to extend the buffer. */ |
| 2611 | temp = malloc(newSize); |
| 2612 | if (lexer->token.text) { |
| 2613 | memcpy(temp, lexer->token.text, lexer->token.length); |
| 2614 | free(lexer->token.text); |
| 2615 | } |
| 2616 | memcpy(temp + lexer->token.length, text, length); |
| 2617 | lexer->token.text = temp; |
| 2618 | lexer->token.length += length; |
| 2619 | lexer->size = newSize; |
| 2620 | } |
| 2621 | |
| 2622 | /*--------------------------------------------------------------------------*/ |
| 2623 | static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer, |
no outgoing calls
no test coverage detected
searching dependent graphs…