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

Function check_inline_props

src/cypher/cypher.c:3005–3029  ·  view source on GitHub ↗

Check inline property filters. * Values that look like regex patterns are matched with POSIX ERE; * plain values use exact strcmp. */

Source from the content-addressed store, hash-verified

3003 * Values that look like regex patterns are matched with POSIX ERE;
3004 * plain values use exact strcmp. */
3005static bool check_inline_props(const cbm_node_t *n, const cbm_prop_filter_t *props, int count,
3006 cbm_store_t *store) {
3007 for (int i = 0; i < count; i++) {
3008 const char *actual = node_prop(n, props[i].key, store);
3009 if (looks_like_regex(props[i].value)) {
3010 cbm_regex_t re;
3011 int comp_rc = cbm_regcomp(&re, props[i].value, CBM_REG_EXTENDED | CBM_REG_NOSUB);
3012 if (comp_rc == 0) {
3013 bool matched = cbm_regexec(&re, actual, 0, NULL, 0) == 0;
3014 cbm_regfree(&re);
3015 if (!matched) {
3016 return false;
3017 }
3018 } else if (strcmp(actual, props[i].value) != 0) {
3019 if (comp_rc == CBM_REG_ETOOBIG) {
3020 g_cypher_regex_refused = true;
3021 }
3022 return false;
3023 }
3024 } else if (strcmp(actual, props[i].value) != 0) {
3025 return false;
3026 }
3027 }
3028 return true;
3029}
3030
3031/* ── Result building helpers ────────────────────────────────────── */
3032

Callers 4

scan_pattern_nodesFunction · 0.85
process_edgesFunction · 0.85
expand_var_lengthFunction · 0.85
start_source_nextFunction · 0.85

Calls 5

node_propFunction · 0.85
looks_like_regexFunction · 0.85
cbm_regcompFunction · 0.85
cbm_regexecFunction · 0.85
cbm_regfreeFunction · 0.85

Tested by

no test coverage detected