MCPcopy Create free account
hub / github.com/KDE/kdevelop / cmListFileLexerSetToken

Function cmListFileLexerSetToken

plugins/cmake/parser/cmListFileLexer.c:2390–2417  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2388
2389/*--------------------------------------------------------------------------*/
2390static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
2391 int length)
2392{
2393 /* Set the token line and column number. */
2394 lexer->token.line = lexer->line;
2395 lexer->token.column = lexer->column;
2396
2397 /* Use the same buffer if possible. */
2398 if (lexer->token.text) {
2399 if (text && length < lexer->size) {
2400 strcpy(lexer->token.text, text);
2401 lexer->token.length = length;
2402 return;
2403 }
2404 free(lexer->token.text);
2405 lexer->token.text = 0;
2406 lexer->size = 0;
2407 }
2408
2409 /* Need to extend the buffer. */
2410 if (text) {
2411 lexer->token.text = strdup(text);
2412 lexer->token.length = length;
2413 lexer->size = length + 1;
2414 } else {
2415 lexer->token.length = 0;
2416 }
2417}
2418
2419/*--------------------------------------------------------------------------*/
2420static 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