| 531 | } |
| 532 | |
| 533 | bool validateSnakeCaseNaming(const KeyRef& k) { |
| 534 | KeyRef key(k); |
| 535 | // Remove prefix \xff\xff |
| 536 | ASSERT(key.startsWith(specialKeys.begin)); |
| 537 | key = key.removePrefix(specialKeys.begin); |
| 538 | // Suffix can be \xff\xff or \x00 in single key range |
| 539 | if (key.endsWith(specialKeys.begin)) |
| 540 | key = key.removeSuffix(specialKeys.end); |
| 541 | else if (key.endsWith(LiteralStringRef("\x00"))) |
| 542 | key = key.removeSuffix(LiteralStringRef("\x00")); |
| 543 | for (const char& c : key.toString()) { |
| 544 | // only small letters, numbers, '/', '_' is allowed |
| 545 | ASSERT((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '/' || c == '_'); |
| 546 | } |
| 547 | return true; |
| 548 | } |
| 549 | |
| 550 | void SpecialKeySpace::registerKeyRange(SpecialKeySpace::MODULE module, |
| 551 | SpecialKeySpace::IMPLTYPE type, |
no test coverage detected