Check inline property filters. * Values that look like regex patterns are matched with POSIX ERE; * plain values use exact strcmp. */
| 2758 | * Values that look like regex patterns are matched with POSIX ERE; |
| 2759 | * plain values use exact strcmp. */ |
| 2760 | static bool check_inline_props(const cbm_node_t *n, const cbm_prop_filter_t *props, int count, |
| 2761 | cbm_store_t *store) { |
| 2762 | for (int i = 0; i < count; i++) { |
| 2763 | const char *actual = node_prop(n, props[i].key, store); |
| 2764 | if (looks_like_regex(props[i].value)) { |
| 2765 | cbm_regex_t re; |
| 2766 | if (cbm_regcomp(&re, props[i].value, CBM_REG_EXTENDED | CBM_REG_NOSUB) == 0) { |
| 2767 | bool matched = cbm_regexec(&re, actual, 0, NULL, 0) == 0; |
| 2768 | cbm_regfree(&re); |
| 2769 | if (!matched) { |
| 2770 | return false; |
| 2771 | } |
| 2772 | } else if (strcmp(actual, props[i].value) != 0) { |
| 2773 | return false; |
| 2774 | } |
| 2775 | } else if (strcmp(actual, props[i].value) != 0) { |
| 2776 | return false; |
| 2777 | } |
| 2778 | } |
| 2779 | return true; |
| 2780 | } |
| 2781 | |
| 2782 | /* ── Result building helpers ────────────────────────────────────── */ |
| 2783 |
no test coverage detected