diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-09-21 08:49:59 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-09-21 18:16:26 +0200 |
commit | 308ec0b7df3bd61c664b1814b5442bd97a04f17d (patch) | |
tree | e9dc79f77753e72a1face8c407986cea47c912ef | |
parent | 1f97e1aacaa461aafa0387d63f8480ca161742c1 (diff) | |
download | strongswan-308ec0b7df3bd61c664b1814b5442bd97a04f17d.tar.bz2 strongswan-308ec0b7df3bd61c664b1814b5442bd97a04f17d.tar.xz |
Avoid calculating the hash if hashtable is empty
-rw-r--r-- | src/libstrongswan/utils/hashtable.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/hashtable.c b/src/libstrongswan/utils/hashtable.c index 498d107e3..d181d8ec8 100644 --- a/src/libstrongswan/utils/hashtable.c +++ b/src/libstrongswan/utils/hashtable.c @@ -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) { |