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

Function dk_join

src/pipeline/pass_docker.c:675–695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673/* ── Paths in the image and in the repository ────────────────────────── */
674
675static const char *dk_join(dk_t *d, const char *a, const char *b) {
676 if (!a || !a[0]) {
677 return b;
678 }
679 if (!b || !b[0]) {
680 return a;
681 }
682 size_t al = strlen(a);
683 size_t bl = strlen(b);
684 char *s = cbm_arena_alloc(d->a, al + bl + PAIR_LEN);
685 if (s) {
686 memcpy(s, a, al);
687 size_t n = al;
688 if (a[al - SKIP_ONE] != '/') {
689 s[n++] = '/';
690 }
691 memcpy(s + n, b, bl);
692 s[n + bl] = '\0';
693 }
694 return s;
695}
696
697/* `p` with "." and empty segments dropped and ".." applied; an absolute path
698 * stays absolute ("/" at most), a relative one climbing out keeps "..". */

Callers 4

dk_absoluteFunction · 0.85
dk_repoFunction · 0.85
dk_originFunction · 0.85
dk_in_ctxFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected