Frozen config matching must not depend on the process locale. */
| 584 | |
| 585 | /* Frozen config matching must not depend on the process locale. */ |
| 586 | static 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 | |
| 607 | static cbm_userconfig_snapshot_status_t snapshot_entry(CBMArena *arena, cbm_userconfig_t *cfg, |
| 608 | yyjson_val *key, yyjson_val *value) { |