MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / binding_set

Function binding_set

src/cypher/cypher.c:2605–2620  ·  view source on GitHub ↗

Deep-copy a node into a binding (binding owns the strings) */

Source from the content-addressed store, hash-verified

2603
2604/* Deep-copy a node into a binding (binding owns the strings) */
2605static void binding_set(binding_t *b, const char *var, const cbm_node_t *node) {
2606 /* Check existing — free old fields first */
2607 for (int i = 0; i < b->var_count; i++) {
2608 if (strcmp(b->var_names[i], var) == 0) {
2609 node_fields_free(&b->var_nodes[i]);
2610 node_deep_copy(&b->var_nodes[i], node);
2611 return;
2612 }
2613 }
2614 if (b->var_count >= CYP_MAX_VARS) {
2615 return;
2616 }
2617 b->var_names[b->var_count] = var; /* not owned — points to AST string */
2618 node_deep_copy(&b->var_nodes[b->var_count], node);
2619 b->var_count++;
2620}
2621
2622/* binding_set for a node the caller owns and is done with: the binding takes
2623 * its strings instead of copying them, and *node is left empty, so the

Callers 5

expand_var_lengthFunction · 0.85
with_agg_rowsFunction · 0.85
execute_with_simpleFunction · 0.85
cross_join_nodesFunction · 0.85
cross_join_with_relsFunction · 0.85

Calls 2

node_fields_freeFunction · 0.85
node_deep_copyFunction · 0.85

Tested by

no test coverage detected