Check if any library identifier appears in the QN on identifier * boundaries (see qn_hit_on_boundary). Case-sensitive: "requests" matches * "project.venv.requests.api.get" and "svc.requests_get" but neither * "Requests" nor "myrequests". */
| 650 | * "project.venv.requests.api.get" and "svc.requests_get" but neither |
| 651 | * "Requests" nor "myrequests". */ |
| 652 | static const lib_pattern_t *match_qn(const char *qn, const lib_pattern_t *patterns) { |
| 653 | if (!qn || !qn[0]) { |
| 654 | return NULL; |
| 655 | } |
| 656 | for (int i = 0; patterns[i].library_id != NULL; i++) { |
| 657 | const char *id = patterns[i].library_id; |
| 658 | size_t id_len = strlen(id); |
| 659 | if (id_len == 0) { |
| 660 | continue; |
| 661 | } |
| 662 | for (const char *hit = strstr(qn, id); hit != NULL; hit = strstr(hit + 1, id)) { |
| 663 | if (qn_hit_on_boundary(qn, hit, id, id_len)) { |
| 664 | return &patterns[i]; |
| 665 | } |
| 666 | } |
| 667 | } |
| 668 | return NULL; |
| 669 | } |
| 670 | |
| 671 | static bool starts_with_segment(const char *path, const char *segment) { |
| 672 | if (!path || path[0] != '/' || !segment) { |
no test coverage detected