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

Function ws_prefix_equal

src/foundation/workspace.c:247–257  ·  view source on GitHub ↗

strncmp that treats "/" and "\" as the same character. On Windows a * canonical path arrives with backslashes from the resolver and with forward * slashes from callers that normalize, and both spell one directory. Stops at * the end of either string like strncmp does. */

Source from the content-addressed store, hash-verified

245 * slashes from callers that normalize, and both spell one directory. Stops at
246 * the end of either string like strncmp does. */
247static bool ws_prefix_equal(const char *a, const char *b, size_t len) {
248 for (size_t i = 0; i < len; i++) {
249 if (a[i] != b[i] && !(ws_is_sep(a[i]) && ws_is_sep(b[i]))) {
250 return false;
251 }
252 if (a[i] == '\0') {
253 break;
254 }
255 }
256 return true;
257}
258
259/* True when b is a or lives under a. Compares on a separator boundary so
260 * "/a/bc" is not treated as living under "/a/b". */

Callers 1

ws_is_ancestor_or_equalFunction · 0.85

Calls 1

ws_is_sepFunction · 0.85

Tested by

no test coverage detected