MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / match_qn

Function match_qn

internal/cbm/service_patterns.c:652–669  ·  view source on GitHub ↗

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". */

Source from the content-addressed store, hash-verified

650 * "project.venv.requests.api.get" and "svc.requests_get" but neither
651 * "Requests" nor "myrequests". */
652static 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
671static bool starts_with_segment(const char *path, const char *segment) {
672 if (!path || path[0] != '/' || !segment) {

Callers 2

Calls 1

qn_hit_on_boundaryFunction · 0.85

Tested by

no test coverage detected