--- Helper: add using declaration ---
| 165 | |
| 166 | // --- Helper: add using declaration --- |
| 167 | static 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 --- |
| 190 | static void c_add_ns_alias(CLSPContext *ctx, const char *alias, const char *full_qn) { |
no test coverage detected