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

Function hl_long_dir

tests/test_cli.c:16100–16114  ·  view source on GitHub ↗

" /hhh…/hhh…" of exactly `len` bytes, every component short of * NAME_MAX. False when it cannot be built. */

Source from the content-addressed store, hash-verified

16098/* "<root>/hhh…/hhh…" of exactly `len` bytes, every component short of
16099 * NAME_MAX. False when it cannot be built. */
16100static bool hl_long_dir(char *out, size_t out_sz, const char *root, size_t len) {
16101 int n = snprintf(out, out_sz, "%s", root);
16102 if (n <= 0 || (size_t)n >= len || len >= out_sz) {
16103 return false;
16104 }
16105 size_t at = (size_t)n;
16106 while (at < len) {
16107 out[at++] = '/';
16108 for (int seg = 0; seg < HL_SEGMENT && at < len; seg++) {
16109 out[at++] = 'h';
16110 }
16111 }
16112 out[at] = '\0';
16113 return out[len - 1] != '/';
16114}
16115
16116/* The first HL_PATH_CAP - 1 bytes of "<base>/<suffix>": the name the old
16117 * unchecked 1 KiB buffer cut that path down to. */

Callers 1

test_cli.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected