Check inline property filters. * Values that look like regex patterns are matched with POSIX ERE; * plain values use exact strcmp. */
| 2535 | * Values that look like regex patterns are matched with POSIX ERE; |
| 2536 | * plain values use exact strcmp. */ |
| 2537 | static bool check_inline_props(const cbm_node_t *n, const cbm_prop_filter_t *props, int count, |
| 2538 | cbm_store_t *store) { |
| 2539 | for (int i = 0; i < count; i++) { |
| 2540 | const char *actual = node_prop(n, props[i].key, store); |
| 2541 | if (looks_like_regex(props[i].value)) { |
| 2542 | cbm_regex_t re; |
| 2543 | if (cbm_regcomp(&re, props[i].value, CBM_REG_EXTENDED | CBM_REG_NOSUB) == 0) { |
| 2544 | bool matched = cbm_regexec(&re, actual, 0, NULL, 0) == 0; |
| 2545 | cbm_regfree(&re); |
| 2546 | if (!matched) { |
| 2547 | return false; |
| 2548 | } |
| 2549 | } else if (strcmp(actual, props[i].value) != 0) { |
| 2550 | return false; |
| 2551 | } |
| 2552 | } else if (strcmp(actual, props[i].value) != 0) { |
| 2553 | return false; |
| 2554 | } |
| 2555 | } |
| 2556 | return true; |
| 2557 | } |
| 2558 | |
| 2559 | /* ── Result building helpers ────────────────────────────────────── */ |
| 2560 |
no test coverage detected