libart
libart copied to clipboard
[BUG] key_len not work with longer key
BUG:
art_insert(&tree, "example", strlen("example"));
/* follow will success */
art_search(&tree, "example", strlen("example"));
/* follow will fail */
art_search(&tree, "example.com", strlen("example"));
FIX:
void* art_search(const art_tree *t, const unsigned char *key, int key_len) {
...skip...
// Recursively search
child = find_child(n,
depth < key_len ? key[depth]: 0);
n = (child) ? *child : NULL;
...skip...
}