feat: remove edge case checking for empty key

trie-skips
Jef Roosens 2022-11-29 15:10:12 +01:00
parent 88ea0db2ee
commit 1e5442379f
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 0 additions and 21 deletions

View File

@ -134,15 +134,6 @@ typedef struct searchresult {
SearchResult trie_search_node(Trie *trie, const char *key) {
SearchResult out = {NULL, NULL};
// Edge case for empty string
if (key[0] == DELIMITER) {
if (trie->root->represents) {
out.child = trie->root;
}
return out;
}
size_t i = 0;
size_t offset;
TrieNode **node_ptr = &(trie->root);
@ -229,18 +220,6 @@ Entry *trie_search(Trie *trie, const char *key) {
*/
bool trie_add_no_lock(Trie *trie, const char *string,
Entry *entry) {
// Edge case for empty string
if (string[0] == DELIMITER) {
if (trie->root->represents) {
return false;
}
trie->root->represents = true;
trie->size++;
return true;
}
size_t i = 0;
uint8_t offset;
TrieNode **node_ptr = &(trie->root);