From: Ripduman Sohan <[email protected]> It's cheaper and simpler to do a comparison based on a match with the (unique) memory address of the h_next item as opposed to doing a comparison of the hash value and string comparison of the key
Signed-off-by: Ripduman Sohan <[email protected]> --- engines/default_engine/assoc.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/engines/default_engine/assoc.c b/engines/default_engine/assoc.c index 74ac12d..3d30647 100644 --- a/engines/default_engine/assoc.c +++ b/engines/default_engine/assoc.c @@ -117,9 +117,8 @@ static inline hash_item** _hashitem_before(struct default_engine *engine, hash_item *it) { hash_item **pos = &bucket->head; - while (*pos && ((it->hash != (*pos)->hash) || memcmp(item_get_key(it), item_get_key(*pos), it->nkey))) { + while (*pos && *pos != it) pos = &(*pos)->h_next; - } return pos; } -- 1.7.1
