MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tm_argument_append

Function tm_argument_append

src/mcp/test_impact.c:760–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758} tm_invocation_t;
759
760static bool tm_argument_append(tm_invocation_t *invocation, const tm_argument_t *arg) {
761 if (invocation->count == invocation->cap) {
762 if (invocation->cap > INT_MAX / 2)
763 return false;
764 int cap = invocation->cap ? invocation->cap * 2 : 8;
765 if ((size_t)cap > SIZE_MAX / sizeof(*invocation->args))
766 return false;
767 tm_argument_t *args = cbm_arena_alloc(&invocation->arena, (size_t)cap * sizeof(*args));
768 if (!args)
769 return false;
770 if (invocation->count)
771 memcpy(args, invocation->args, (size_t)invocation->count * sizeof(*args));
772 invocation->args = args;
773 invocation->cap = cap;
774 }
775 invocation->args[invocation->count++] = *arg;
776 return true;
777}
778
779/* C macro argument commas are shielded by parentheses, not by brackets,
780 * braces or template angle brackets. The lexer handles comments and ordinary

Callers 1

tm_invocation_parseFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected