MCPcopy Create free account
hub / github.com/Kitware/CMake / cmListFileLexerAppend

Function cmListFileLexerAppend

Source/LexerParser/cmListFileLexer.c:2596–2620  ·  view source on GitHub ↗

--------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

2594
2595/*--------------------------------------------------------------------------*/
2596static 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/*--------------------------------------------------------------------------*/
2623static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,

Callers 1

cmListFileLexer.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…