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

Function strip_extension

src/pipeline/pass_pkgmap.c:156–167  ·  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

154/* Strip file extension from a path. Returns heap-allocated string.
155 * "src/index.ts" → "src/index", "lib/main" → "lib/main" */
156static char *strip_extension(const char *path) {
157 size_t len = strlen(path);
158 for (size_t i = len; i > 0; i--) {
159 if (path[i - SKIP_ONE] == '.') {
160 return cbm_strndup(path, i - SKIP_ONE);
161 }
162 if (path[i - SKIP_ONE] == '/') {
163 break;
164 }
165 }
166 return strdup(path);
167}
168
169/* Join directory + relative entry path, normalize.
170 * "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