summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/hash.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-10-03 17:13:22 +0000
committerBenny Prijono <bennylp@teluu.com>2006-10-03 17:13:22 +0000
commit7582a777333ad344a6555e44011aff219c30a624 (patch)
tree719cf50d3e77fb4abce21ce7e6b559bb264d1a7e /pjlib/src/pj/hash.c
parentace2736c8685df31d777fe669797838546d09c81 (diff)
Fixed bug in the hash table size calculation. The hash table creation API (pj_hash_create()) suggests that the size should be 2^n-1, and when the size is not 2^n-1, it will be rounded-up to the nearest 2^n-1, except when the size is exactly 2^n, then it will be rounded-down to 2^n-1.
The bug caused the hash table size to be doubled when application gives 2^n size (instead of rounding it down to 2^n-1). Nothing dangerous happened because of the bug, it just caused hash table size to be doubled the requirement. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@748 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/hash.c')
-rw-r--r--pjlib/src/pj/hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pjlib/src/pj/hash.c b/pjlib/src/pj/hash.c
index 5a03ecb8..a3daad3c 100644
--- a/pjlib/src/pj/hash.c
+++ b/pjlib/src/pj/hash.c
@@ -115,7 +115,7 @@ PJ_DEF(pj_hash_table_t*) pj_hash_create(pj_pool_t *pool, unsigned size)
table_size = 8;
do {
table_size <<= 1;
- } while (table_size <= size);
+ } while (table_size < size);
table_size -= 1;
h->rows = table_size;