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