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:114–134  ·  view source on GitHub ↗

--- Helper: add using declaration ---

Source from the content-addressed store, hash-verified

112
113// --- Helper: add using declaration ---
114static void c_add_using_decl(CLSPContext *ctx, const char *short_name, const char *full_qn) {
115 if (ctx->using_decl_count >= ctx->using_decl_cap) {
116 int new_cap = ctx->using_decl_cap == 0 ? 16 : ctx->using_decl_cap * 2;
117 const char **new_names =
118 (const char **)cbm_arena_alloc(ctx->arena, new_cap * sizeof(const char *));
119 const char **new_qns =
120 (const char **)cbm_arena_alloc(ctx->arena, new_cap * sizeof(const char *));
121 if (!new_names || !new_qns)
122 return;
123 if (ctx->using_decl_names && ctx->using_decl_count > 0) {
124 memcpy(new_names, ctx->using_decl_names, ctx->using_decl_count * sizeof(const char *));
125 memcpy(new_qns, ctx->using_decl_qns, ctx->using_decl_count * sizeof(const char *));
126 }
127 ctx->using_decl_names = new_names;
128 ctx->using_decl_qns = new_qns;
129 ctx->using_decl_cap = new_cap;
130 }
131 ctx->using_decl_names[ctx->using_decl_count] = cbm_arena_strdup(ctx->arena, short_name);
132 ctx->using_decl_qns[ctx->using_decl_count] = cbm_arena_strdup(ctx->arena, full_qn);
133 ctx->using_decl_count++;
134}
135
136// --- Helper: add namespace alias ---
137static 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