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

Function cross_join_nodes

src/cypher/cypher.c:4176–4199  ·  view source on GitHub ↗

Cross-join node-only pattern into existing bindings */

Source from the content-addressed store, hash-verified

4174
4175/* Cross-join node-only pattern into existing bindings */
4176static void cross_join_nodes(binding_t **bindings, int *bind_count, cbm_node_t *extra_nodes,
4177 int extra_count, const char *nvar, bool opt) {
4178 binding_t *new_bindings = malloc(((*bind_count * extra_count) + SKIP_ONE) * sizeof(binding_t));
4179 int new_count = 0;
4180 for (int bi = 0; bi < *bind_count; bi++) {
4181 for (int ni = 0; ni < extra_count; ni++) {
4182 binding_t nb = {0};
4183 binding_copy(&nb, &(*bindings)[bi]);
4184 binding_set(&nb, nvar, &extra_nodes[ni]);
4185 new_bindings[new_count++] = nb;
4186 }
4187 if (opt && extra_count == 0) {
4188 binding_t nb = {0};
4189 binding_copy(&nb, &(*bindings)[bi]);
4190 new_bindings[new_count++] = nb;
4191 }
4192 }
4193 for (int bi = 0; bi < *bind_count; bi++) {
4194 binding_free(&(*bindings)[bi]);
4195 }
4196 free(*bindings);
4197 *bindings = new_bindings;
4198 *bind_count = new_count;
4199}
4200
4201/* Cross-join pattern-with-rels into existing bindings */
4202static void cross_join_with_rels(cbm_store_t *store, cbm_pattern_t *patn, binding_t **bindings,

Callers 1

Calls 3

binding_copyFunction · 0.85
binding_setFunction · 0.85
binding_freeFunction · 0.85

Tested by

no test coverage detected