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

Function ha_path_contains_mode

src/cli/hook_augment.c:751–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751static bool ha_path_contains_mode(const char *root, const char *candidate, bool case_insensitive) {
752 if (!root || !candidate) {
753 return false;
754 }
755 size_t root_len = strlen(root);
756 size_t candidate_len = strlen(candidate);
757 if (root_len == 0U || candidate_len < root_len) {
758 return false;
759 }
760 bool prefix = true;
761 for (size_t i = 0U; i < root_len; i++) {
762 unsigned char left = (unsigned char)root[i];
763 unsigned char right = (unsigned char)candidate[i];
764 if (case_insensitive) {
765 left = (unsigned char)tolower(left);
766 right = (unsigned char)tolower(right);
767 }
768 if (left != right) {
769 prefix = false;
770 break;
771 }
772 }
773 return prefix &&
774 (candidate_len == root_len || root[root_len - 1U] == '/' || candidate[root_len] == '/');
775}
776
777static bool ha_path_contains(const char *root, const char *candidate) {
778#ifdef _WIN32

Callers 2

ha_path_containsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected