Read grep output from fp, parse file:line:content format, apply path filter, * and return a dynamically-allocated grep_match_t array. */ Strip root path prefix from a file path. */
| 15199 | * and return a dynamically-allocated grep_match_t array. */ |
| 15200 | /* Strip root path prefix from a file path. */ |
| 15201 | static const char *strip_root_prefix(const char *path, const char *root, size_t root_len) { |
| 15202 | if (strncmp(path, root, root_len) != 0) { |
| 15203 | return path; |
| 15204 | } |
| 15205 | const char *p = path + root_len; |
| 15206 | if (*p == '/') { |
| 15207 | p++; |
| 15208 | } |
| 15209 | return p; |
| 15210 | } |
| 15211 | |
| 15212 | static bool search_match_bounds(const char *content, const char *pattern, bool use_regex, |
| 15213 | const cbm_regex_t *compiled_regex, size_t *start_out, |
no outgoing calls
no test coverage detected