Check inline property filters. * Values that look like regex patterns are matched with POSIX ERE; * plain values use exact strcmp. */
| 3003 | * Values that look like regex patterns are matched with POSIX ERE; |
| 3004 | * plain values use exact strcmp. */ |
| 3005 | static 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 |
no test coverage detected