Commit 5cad086d authored by Geoff Simmons's avatar Geoff Simmons

For key searches, we don't have to special-case for idlen == 0.

memcmp() is defined to return 0 when the length param is 0.
parent 2c41b773
......@@ -318,13 +318,9 @@ key_find(struct key_tree *tree_h, uint8_t *id, uint8_t idlen)
AN(tree_h);
if (VRBT_EMPTY(tree_h))
return NULL;
if (idlen != 0) {
keycmp.id = id;
keycmp.idlen = idlen;
key = VRBT_FIND(key_tree, tree_h, &keycmp);
}
else
key = VRBT_MIN(key_tree, tree_h);
keycmp.id = id;
keycmp.idlen = idlen;
key = VRBT_FIND(key_tree, tree_h, &keycmp);
CHECK_OBJ_ORNULL(key, KEY_MAGIC);
return (key);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment