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

Function strip_extension

src/pipeline/pass_pkgmap.c:152–163  ·  view source on GitHub ↗

Strip file extension from a path. Returns heap-allocated string. * "src/index.ts" → "src/index", "lib/main" → "lib/main" */

Source from the content-addressed store, hash-verified

150/* Strip file extension from a path. Returns heap-allocated string.
151 * "src/index.ts" → "src/index", "lib/main" → "lib/main" */
152static char *strip_extension(const char *path) {
153 size_t len = strlen(path);
154 for (size_t i = len; i > 0; i--) {
155 if (path[i - SKIP_ONE] == '.') {
156 return cbm_strndup(path, i - SKIP_ONE);
157 }
158 if (path[i - SKIP_ONE] == '/') {
159 break;
160 }
161 }
162 return strdup(path);
163}
164
165/* Join directory + relative entry path, normalize.
166 * "packages/foo" + "src/index.ts" → "packages/foo/src/index" (stripped ext) */

Callers 1

join_and_stripFunction · 0.85

Calls 1

cbm_strndupFunction · 0.85

Tested by

no test coverage detected