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:828–852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826}
827
828static bool ha_path_contains_mode(const char *root, const char *candidate, bool case_insensitive) {
829 if (!root || !candidate) {
830 return false;
831 }
832 size_t root_len = strlen(root);
833 size_t candidate_len = strlen(candidate);
834 if (root_len == 0U || candidate_len < root_len) {
835 return false;
836 }
837 bool prefix = true;
838 for (size_t i = 0U; i < root_len; i++) {
839 unsigned char left = (unsigned char)root[i];
840 unsigned char right = (unsigned char)candidate[i];
841 if (case_insensitive) {
842 left = (unsigned char)tolower(left);
843 right = (unsigned char)tolower(right);
844 }
845 if (left != right) {
846 prefix = false;
847 break;
848 }
849 }
850 return prefix &&
851 (candidate_len == root_len || root[root_len - 1U] == '/' || candidate[root_len] == '/');
852}
853
854static bool ha_path_contains(const char *root, const char *candidate) {
855#ifdef _WIN32

Callers 2

ha_path_containsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected