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

Function cmListFileLexerSetToken

Source/LexerParser/cmListFileLexer.c:2565–2593  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2563
2564/*--------------------------------------------------------------------------*/
2565static 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/*--------------------------------------------------------------------------*/
2596static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,

Callers 2

cmListFileLexer.cFile · 0.85
cmListFileLexerDestroyFunction · 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…