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

Function ws_component_equals

src/foundation/workspace.c:109–130  ·  view source on GitHub ↗

Case-insensitive on Windows-style paths, exact elsewhere: NTFS is * case-insensitive, so ".SSH" must not slip past a case-sensitive compare. */

Source from the content-addressed store, hash-verified

107/* Case-insensitive on Windows-style paths, exact elsewhere: NTFS is
108 * case-insensitive, so ".SSH" must not slip past a case-sensitive compare. */
109static bool ws_component_equals(const char *component, size_t len, const char *name,
110 bool fold_case) {
111 if (strlen(name) != len) {
112 return false;
113 }
114 for (size_t i = 0; i < len; i++) {
115 char a = component[i];
116 char b = name[i];
117 if (fold_case) {
118 if (a >= 'A' && a <= 'Z') {
119 a = (char)(a - 'A' + 'a');
120 }
121 if (b >= 'A' && b <= 'Z') {
122 b = (char)(b - 'A' + 'a');
123 }
124 }
125 if (a != b) {
126 return false;
127 }
128 }
129 return true;
130}
131
132/* Directory and file names that carry credentials. Matched against every
133 * component, so both "…/.ssh" and "…/.ssh/sub" are refused. Additive by design:

Callers 3

ws_any_component_matchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected