binding_set for a node the caller owns and is done with: the binding takes * its strings instead of copying them, and *node is left empty, so the * caller's node_fields_free of it is a no-op. A binding with no free slot * takes nothing, as binding_set stores nothing. */
| 2624 | * caller's node_fields_free of it is a no-op. A binding with no free slot |
| 2625 | * takes nothing, as binding_set stores nothing. */ |
| 2626 | static void binding_take_node(binding_t *b, const char *var, cbm_node_t *node) { |
| 2627 | for (int i = 0; i < b->var_count; i++) { |
| 2628 | if (strcmp(b->var_names[i], var) == 0) { |
| 2629 | node_fields_free(&b->var_nodes[i]); |
| 2630 | b->var_nodes[i] = *node; |
| 2631 | memset(node, 0, sizeof(*node)); |
| 2632 | return; |
| 2633 | } |
| 2634 | } |
| 2635 | if (b->var_count >= CYP_MAX_VARS) { |
| 2636 | return; |
| 2637 | } |
| 2638 | b->var_names[b->var_count] = var; /* not owned — points to AST string */ |
| 2639 | b->var_nodes[b->var_count] = *node; |
| 2640 | memset(node, 0, sizeof(*node)); |
| 2641 | b->var_count++; |
| 2642 | } |
| 2643 | |
| 2644 | static const char *eval_multiarg_func(binding_t *b, const cbm_return_item_t *item, char *buf, |
| 2645 | size_t bufsz); |
no test coverage detected