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

Function build_file_variant

internal/cbm/helpers.c:1700–1713  ·  view source on GitHub ↗

Internal helper: find extension start in basename (returns length without ext) A container build file named for its variant ("Dockerfile.debug") keeps * the suffix (no language extension; dropping it gives the variant the QN of * the plain Dockerfile beside it). Mirrors strip_file_extension in * src/pipeline/fqn.c -- both must agree. */

Source from the content-addressed store, hash-verified

1698 * the plain Dockerfile beside it). Mirrors strip_file_extension in
1699 * src/pipeline/fqn.c -- both must agree. */
1700static bool build_file_variant(const char *s, size_t len) {
1701 size_t b = len;
1702 while (b > 0 && s[b - SKIP_ONE] != '/') {
1703 b--;
1704 }
1705 static const char *const BASES[] = {"Dockerfile.", "Containerfile."};
1706 for (size_t i = 0; i < sizeof(BASES) / sizeof(BASES[0]); i++) {
1707 size_t bl = strlen(BASES[i]);
1708 if (len - b > bl && strncmp(s + b, BASES[i], bl) == 0) {
1709 return true;
1710 }
1711 }
1712 return false;
1713}
1714
1715static size_t strip_ext_len(const char *s, size_t len) {
1716 if (build_file_variant(s, len)) {

Callers 1

strip_ext_lenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected