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

Function cs_fields_add_debug

internal/cbm/lsp/cs_lsp.c:2393–2419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2391}
2392
2393static void cs_fields_add_debug(CBMArena *arena, cs_fields_t *f, const char *name,
2394 const CBMType *type, bool debug) {
2395 (void)debug;
2396 if (!f || !name) return;
2397 /* Dedupe. */
2398 for (int i = 0; i < f->count; i++) {
2399 if (strcmp(f->field_names[i], name) == 0) return;
2400 }
2401 if (f->count + 2 >= f->cap) {
2402 int new_cap = f->cap * 2;
2403 const char **nn = (const char **)cbm_arena_alloc(arena, (size_t)new_cap * sizeof(*nn));
2404 const CBMType **nt = (const CBMType **)cbm_arena_alloc(arena, (size_t)new_cap * sizeof(*nt));
2405 if (!nn || !nt) return;
2406 for (int i = 0; i < f->count; i++) {
2407 nn[i] = f->field_names[i];
2408 nt[i] = f->field_types[i];
2409 }
2410 f->field_names = nn;
2411 f->field_types = nt;
2412 f->cap = new_cap;
2413 }
2414 f->field_names[f->count] = cbm_arena_strdup(arena, name);
2415 f->field_types[f->count] = type ? type : cbm_type_unknown();
2416 f->count++;
2417 f->field_names[f->count] = NULL;
2418 f->field_types[f->count] = NULL;
2419}
2420
2421static void cs_collect_class_fields(CSLSPContext *ctx, CBMTypeRegistry *reg, TSNode root,
2422 cs_fields_table_t *tab) {

Callers 2

cs_fields_addFunction · 0.85
cs_collect_class_fieldsFunction · 0.85

Calls 3

cbm_type_unknownFunction · 0.85
cbm_arena_allocFunction · 0.50
cbm_arena_strdupFunction · 0.50

Tested by

no test coverage detected