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