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

Function ws_component_equals

src/foundation/workspace.c:108–129  ·  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

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

Callers 2

ws_any_component_matchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected