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

Function snapshot_language

src/discover/userconfig.c:586–605  ·  view source on GitHub ↗

Frozen config matching must not depend on the process locale. */

Source from the content-addressed store, hash-verified

584
585/* Frozen config matching must not depend on the process locale. */
586static CBMLanguage snapshot_language(yyjson_val *value) {
587 const unsigned char *name = (const unsigned char *)yyjson_get_str(value);
588 size_t len = yyjson_get_len(value);
589 for (size_t i = 0; i < LANG_NAME_TABLE_SIZE; i++) {
590 const char *alias = LANG_NAME_TABLE[i].name;
591 if (strlen(alias) != len)
592 continue;
593 size_t j = 0;
594 for (; j < len; j++) {
595 unsigned char byte = name[j];
596 if (byte >= 'A' && byte <= 'Z')
597 byte = (unsigned char)(byte + ('a' - 'A'));
598 if (byte != (unsigned char)alias[j])
599 break;
600 }
601 if (j == len)
602 return LANG_NAME_TABLE[i].lang;
603 }
604 return CBM_LANG_COUNT;
605}
606
607static cbm_userconfig_snapshot_status_t snapshot_entry(CBMArena *arena, cbm_userconfig_t *cfg,
608 yyjson_val *key, yyjson_val *value) {

Callers 1

snapshot_entryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected