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

Function dk_dir

src/pipeline/pass_docker.c:770–784  ·  view source on GitHub ↗

The directory of normalised path `p` ("/" for "/x", "" for "x"). */

Source from the content-addressed store, hash-verified

768
769/* The directory of normalised path `p` ("/" for "/x", "" for "x"). */
770static const char *dk_dir(dk_t *d, const char *p) {
771 const char *s = strrchr(p, '/');
772 if (!s) {
773 return "";
774 }
775 if (s == p) {
776 return "/";
777 }
778 char *out = cbm_arena_alloc(d->a, (size_t)(s - p) + SKIP_ONE);
779 if (out) {
780 memcpy(out, p, (size_t)(s - p));
781 out[s - p] = '\0';
782 }
783 return out;
784}
785
786static bool dk_ends(const char *s, const char *suffix) {
787 size_t l = strlen(s);

Callers 1

dk_gomainFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected