Avoid calculating the hash if hashtable is empty
This commit is contained in:
1 parent
1f97e1aaca
commit
308ec0b7df
1 file changed
+5
@@ -257,6 +257,11 @@ static void *get_internal(private_hashtable_t *this, void *key,
|
||||
void *value = NULL;
|
||||
pair_t *pair;
|
||||
|
||||
if (!this->count)
|
||||
{ /* no need to calculate the hash */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pair = this->table[this->hash(key) & this->mask];
|
||||
while (pair)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user