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

Function c_add_using_decl

internal/cbm/lsp/c_lsp.c:167–187  ·  view source on GitHub ↗

--- Helper: add using declaration ---

Source from the content-addressed store, hash-verified

165
166// --- Helper: add using declaration ---
167static void c_add_using_decl(CLSPContext *ctx, const char *short_name, const char *full_qn) {
168 if (ctx->using_decl_count >= ctx->using_decl_cap) {
169 int new_cap = ctx->using_decl_cap == 0 ? 16 : ctx->using_decl_cap * 2;
170 const char **new_names =
171 (const char **)cbm_arena_alloc(ctx->arena, new_cap * sizeof(const char *));
172 const char **new_qns =
173 (const char **)cbm_arena_alloc(ctx->arena, new_cap * sizeof(const char *));
174 if (!new_names || !new_qns)
175 return;
176 if (ctx->using_decl_names && ctx->using_decl_count > 0) {
177 memcpy(new_names, ctx->using_decl_names, ctx->using_decl_count * sizeof(const char *));
178 memcpy(new_qns, ctx->using_decl_qns, ctx->using_decl_count * sizeof(const char *));
179 }
180 ctx->using_decl_names = new_names;
181 ctx->using_decl_qns = new_qns;
182 ctx->using_decl_cap = new_cap;
183 }
184 ctx->using_decl_names[ctx->using_decl_count] = cbm_arena_strdup(ctx->arena, short_name);
185 ctx->using_decl_qns[ctx->using_decl_count] = cbm_arena_strdup(ctx->arena, full_qn);
186 ctx->using_decl_count++;
187}
188
189// --- Helper: add namespace alias ---
190static void c_add_ns_alias(CLSPContext *ctx, const char *alias, const char *full_qn) {

Callers 1

c_process_statementFunction · 0.85

Calls 2

cbm_arena_allocFunction · 0.50
cbm_arena_strdupFunction · 0.50

Tested by

no test coverage detected