MCPcopy Index your code
hub / github.com/IBM/Project_CodeNet / token_buf_room

Function token_buf_room

tools/tokenizer/libtoken.c:453–473  ·  view source on GitHub ↗

Makes sure there is room in the token buffer.

Source from the content-addressed store, hash-verified

451
452// Makes sure there is room in the token buffer.
453static void token_buf_room(void)
454{
455 if (token_len == token_alloc) { // all space used up
456 if (!token_alloc) { // first time allocation
457 token_alloc = 65536;
458 if (!(token_buf = malloc(token_alloc))) {
459 fprintf(stderr, "(F): Allocation of token buffer failed.\n");
460 exit(4);
461 }
462 token_buf[0] = '\0'; // for safety
463 return;
464 }
465
466 token_alloc <<= 1;
467 if (!(token_buf = realloc(token_buf, token_alloc))) {
468 fprintf(stderr, "(F): Reallocation of token buffer failed.\n");
469 exit(4);
470 }
471 //fprintf(stderr, "Realloc-ed token buf.\n");
472 }
473}
474
475// Appends a character to the token buffer, always making sure there is room.
476static void token_buf_push(int cc)

Callers 2

token_buf_pushFunction · 0.85
token_buf_closeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected