Deep-copy a node into a binding (binding owns the strings) */
| 2522 | |
| 2523 | /* Deep-copy a node into a binding (binding owns the strings) */ |
| 2524 | static void binding_set(binding_t *b, const char *var, const cbm_node_t *node) { |
| 2525 | /* Check existing — free old fields first */ |
| 2526 | for (int i = 0; i < b->var_count; i++) { |
| 2527 | if (strcmp(b->var_names[i], var) == 0) { |
| 2528 | node_fields_free(&b->var_nodes[i]); |
| 2529 | node_deep_copy(&b->var_nodes[i], node); |
| 2530 | return; |
| 2531 | } |
| 2532 | } |
| 2533 | if (b->var_count >= CYP_MAX_VARS) { |
| 2534 | return; |
| 2535 | } |
| 2536 | b->var_names[b->var_count] = var; /* not owned — points to AST string */ |
| 2537 | node_deep_copy(&b->var_nodes[b->var_count], node); |
| 2538 | b->var_count++; |
| 2539 | } |
| 2540 | |
| 2541 | static const char *eval_multiarg_func(binding_t *b, const cbm_return_item_t *item, char *buf, |
| 2542 | size_t bufsz); |
no test coverage detected