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

Function lang_from_string

src/discover/userconfig.c:133–152  ·  view source on GitHub ↗

* Parse a language string (case-insensitive) to a CBMLanguage enum. * Returns CBM_LANG_COUNT if the string is not recognized. */

Source from the content-addressed store, hash-verified

131 * Returns CBM_LANG_COUNT if the string is not recognized.
132 */
133static CBMLanguage lang_from_string(const char *s) {
134 if (!s || !s[0]) {
135 return CBM_LANG_COUNT;
136 }
137
138 /* Build a lowercase copy for comparison */
139 char lower[CBM_SZ_64];
140 size_t i;
141 for (i = 0; i < sizeof(lower) - SKIP_ONE && s[i]; i++) {
142 lower[i] = (char)tolower((unsigned char)s[i]);
143 }
144 lower[i] = '\0';
145
146 for (size_t j = 0; j < LANG_NAME_TABLE_SIZE; j++) {
147 if (strcmp(LANG_NAME_TABLE[j].name, lower) == 0) {
148 return LANG_NAME_TABLE[j].lang;
149 }
150 }
151 return CBM_LANG_COUNT;
152}
153
154/* ── Config directory helper ─────────────────────────────────────── */
155

Callers 1

parse_extra_extensionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected