diff options
Diffstat (limited to 'pjlib/src/pj/hash.c')
-rw-r--r-- | pjlib/src/pj/hash.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/pjlib/src/pj/hash.c b/pjlib/src/pj/hash.c index 5a97e5f1..5b3454d9 100644 --- a/pjlib/src/pj/hash.c +++ b/pjlib/src/pj/hash.c @@ -55,13 +55,13 @@ PJ_DEF(pj_uint32_t) pj_hash_calc(pj_uint32_t hash, const void *key, PJ_CHECK_STACK(); if (keylen==PJ_HASH_KEY_STRING) { - const unsigned char *p = key; + const pj_uint8_t *p = (const pj_uint8_t*)key; for ( ; *p; ++p ) { hash = (hash * PJ_HASH_MULTIPLIER) + *p; } } else { - const unsigned char *p = key, - *end = p + keylen; + const pj_uint8_t *p = (const pj_uint8_t*)key, + *end = p + keylen; for ( ; p!=end; ++p) { hash = (hash * PJ_HASH_MULTIPLIER) + *p; } @@ -103,7 +103,7 @@ PJ_DEF(pj_hash_table_t*) pj_hash_create(pj_pool_t *pool, unsigned size) /* Check that PJ_HASH_ENTRY_SIZE is correct. */ PJ_ASSERT_RETURN(sizeof(pj_hash_entry)==PJ_HASH_ENTRY_SIZE, NULL); - h = pj_pool_alloc(pool, sizeof(pj_hash_table_t)); + h = PJ_POOL_ALLOC_T(pool, pj_hash_table_t); h->count = 0; PJ_LOG( 6, ("hashtbl", "hash table %p created from pool %s", h, pj_pool_getobjname(pool))); @@ -119,7 +119,8 @@ PJ_DEF(pj_hash_table_t*) pj_hash_create(pj_pool_t *pool, unsigned size) table_size -= 1; h->rows = table_size; - h->table = pj_pool_calloc(pool, table_size+1, sizeof(pj_hash_entry*)); + h->table = (pj_hash_entry**) + pj_pool_calloc(pool, table_size+1, sizeof(pj_hash_entry*)); return h; } @@ -142,14 +143,14 @@ static pj_hash_entry **find_entry( pj_pool_t *pool, pj_hash_table_t *ht, */ hash=0; if (keylen==PJ_HASH_KEY_STRING) { - const unsigned char *p = key; + const pj_uint8_t *p = (const pj_uint8_t*)key; for ( ; *p; ++p ) { hash = hash * PJ_HASH_MULTIPLIER + *p; } keylen = p - (const unsigned char*)key; } else { - const unsigned char *p = key, - *end = p + keylen; + const pj_uint8_t *p = (const pj_uint8_t*)key, + *end = p + keylen; for ( ; p!=end; ++p) { hash = hash * PJ_HASH_MULTIPLIER + *p; } @@ -179,12 +180,12 @@ static pj_hash_entry **find_entry( pj_pool_t *pool, pj_hash_table_t *ht, * If entry_buf is specified, use it. Otherwise allocate from pool. */ if (entry_buf) { - entry = entry_buf; + entry = (pj_hash_entry*)entry_buf; } else { /* Pool must be specified! */ PJ_ASSERT_RETURN(pool != NULL, NULL); - entry = pj_pool_alloc(pool, sizeof(pj_hash_entry)); + entry = PJ_POOL_ALLOC_T(pool, pj_hash_entry); PJ_LOG(6, ("hashtbl", "%p: New p_entry %p created, pool used=%u, cap=%u", ht, entry, pj_pool_get_used_size(pool), |