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

Function lang_from_string

src/discover/userconfig.c:179–198  ·  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

177 * Returns CBM_LANG_COUNT if the string is not recognized.
178 */
179static CBMLanguage lang_from_string(const char *s) {
180 if (!s || !s[0]) {
181 return CBM_LANG_COUNT;
182 }
183
184 /* Build a lowercase copy for comparison */
185 char lower[CBM_SZ_64];
186 size_t i;
187 for (i = 0; i < sizeof(lower) - SKIP_ONE && s[i]; i++) {
188 lower[i] = (char)tolower((unsigned char)s[i]);
189 }
190 lower[i] = '\0';
191
192 for (size_t j = 0; j < LANG_NAME_TABLE_SIZE; j++) {
193 if (strcmp(LANG_NAME_TABLE[j].name, lower) == 0) {
194 return LANG_NAME_TABLE[j].lang;
195 }
196 }
197 return CBM_LANG_COUNT;
198}
199
200/* ── Config directory helper ─────────────────────────────────────── */
201

Callers 1

parse_extra_extensionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected