Avoid calculating the hash if hashtable is empty

This commit is contained in:
Tobias Brunner
2012-09-21 18:16:26 +02:00
parent 1f97e1aaca
commit 308ec0b7df
+5
View File
@@ -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)
{