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

Function cbm_fqn_module_source_lang

internal/cbm/helpers.c:1844–1867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1842}
1843
1844char *cbm_fqn_module_source_lang(CBMArena *a, const char *project, const char *rel_path,
1845 CBMLanguage lang) {
1846 if (!cbm_lang_module_is_dir(lang)) {
1847 // All other languages keep the legacy filename-stem module QN.
1848 return cbm_fqn_module(a, project, rel_path);
1849 }
1850 if (!rel_path) {
1851 rel_path = "";
1852 }
1853 // Module is the CONTAINING DIRECTORY: strip the basename (last '/' segment).
1854 const char *last_slash = strrchr(rel_path, '/');
1855 if (!last_slash) {
1856 // Root file: dir is empty → module is just the project.
1857 return cbm_fqn_folder(a, project, "");
1858 }
1859 size_t dir_len = (size_t)(last_slash - rel_path);
1860 char *dir = (char *)cbm_arena_alloc(a, dir_len + SKIP_ONE);
1861 if (!dir) {
1862 return NULL;
1863 }
1864 memcpy(dir, rel_path, dir_len);
1865 dir[dir_len] = '\0';
1866 return cbm_fqn_folder(a, project, dir);
1867}
1868
1869char *cbm_fqn_compute_source_lang(CBMArena *a, const char *project, const char *rel_path,
1870 const char *name, CBMLanguage lang) {

Callers 12

jv_scan_scopeFunction · 0.85
extract_file_ex_bodyFunction · 0.85
tr_buildFunction · 0.85
pr_buildFunction · 0.85
jr_buildFunction · 0.85
build_filesFunction · 0.85
pr_index_filesFunction · 0.85
rs_source_metaFunction · 0.85
cbm_stem_marks_initFunction · 0.85
go_dir_getFunction · 0.85

Calls 4

cbm_lang_module_is_dirFunction · 0.85
cbm_fqn_moduleFunction · 0.85
cbm_fqn_folderFunction · 0.85
cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected