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

Function strip_ext_len

internal/cbm/helpers.c:1715–1737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1713}
1714
1715static size_t strip_ext_len(const char *s, size_t len) {
1716 if (build_file_variant(s, len)) {
1717 return len;
1718 }
1719 for (size_t i = len; i > 0; i--) {
1720 if (s[i - SKIP_ONE] == '.') {
1721 /* A dot at the very start of a filename segment (index 0, or right
1722 * after a '/') is a DOTFILE marker (".env", ".gitignore"), NOT an
1723 * extension separator. Stripping there leaves an empty stem whose
1724 * module QN collides with the parent directory/project root. Keep
1725 * the whole name as the stem; the leading dot is dropped later in
1726 * append_path_segments. */
1727 if (i - SKIP_ONE == 0 || s[i - SKIP_ONE - SKIP_ONE] == '/') {
1728 return len;
1729 }
1730 return i - SKIP_ONE;
1731 }
1732 if (s[i - SKIP_ONE] == '/') {
1733 break;
1734 }
1735 }
1736 return len;
1737}
1738
1739// Check if a path part should be skipped (Python __init__, JS/TS index).
1740static bool should_skip_fqn_part(const char *part, size_t part_len, bool is_last, bool has_name) {

Callers 1

cbm_fqn_computeFunction · 0.85

Calls 1

build_file_variantFunction · 0.85

Tested by

no test coverage detected