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

Function cbm_language_probe_bytes_with

src/discover/language.c:1620–1633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618_Static_assert(LANG_PROBE_CFC == CBM_LANGUAGE_PROBE_MAX, "the longest probe is the public bound");
1619
1620size_t cbm_language_probe_bytes_with(const cbm_userconfig_t *config, const char *filename) {
1621 if (!filename) {
1622 return 0;
1623 }
1624 CBMLanguage lang = lang_for_filename(config, filename);
1625 if (lang == CBM_LANG_COUNT) {
1626 return LANG_PROBE_LINE; /* the shebang fallback */
1627 }
1628 const char *ext = lang_probe_extension(filename);
1629 if (ext) {
1630 return strcmp(ext, ".cfc") == 0 ? LANG_PROBE_CFC : LANG_PROBE_HEAD;
1631 }
1632 return lang == CBM_LANG_XML ? LANG_PROBE_LINE : 0;
1633}
1634
1635CBMLanguage cbm_language_classify_with(const cbm_userconfig_t *config, const char *filename,
1636 const unsigned char *head, size_t head_len, bool more,

Callers 2

cbm_language_probe_bytesFunction · 0.85
cls_oneFunction · 0.85

Calls 2

lang_for_filenameFunction · 0.85
lang_probe_extensionFunction · 0.85

Tested by 1

cls_oneFunction · 0.68