diff options
-rw-r--r-- | tables/apr_hash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tables/apr_hash.c b/tables/apr_hash.c index 7e7a59ba4..8085ee33f 100644 --- a/tables/apr_hash.c +++ b/tables/apr_hash.c @@ -275,10 +275,7 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht, he->klen = klen; he->val = val; *hep = he; - /* check that the collision rate isn't too high */ - if (++ht->count > ht->max) { - expand_array(ht); - } + ht->count++; return hep; } @@ -310,6 +307,10 @@ APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, else { /* replace entry */ (*hep)->val = val; + /* check that the collision rate isn't too high */ + if (ht->count > ht->max) { + expand_array(ht); + } } } /* else key not present and val==NULL */ |