Changeset 1429


Ignore:
Timestamp:
Sep 8, 2007 7:12:44 AM (17 years ago)
Author:
bennylp
Message:

Fixed ticket #367: Hash table will duplicate the hash key (thanks Scott Lu)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/hash.c

    r1307 r1429  
    3434{ 
    3535    struct pj_hash_entry *next; 
    36     const void *key; 
     36    void *key; 
    3737    pj_uint32_t hash; 
    3838    pj_uint32_t keylen; 
     
    194194    entry->next = NULL; 
    195195    entry->hash = hash; 
    196     entry->key = key; 
     196    if (pool) { 
     197        entry->key = pj_pool_alloc(pool, keylen); 
     198        pj_memcpy(entry->key, key, keylen); 
     199    } else { 
     200        entry->key = (void*)key; 
     201    } 
    197202    entry->keylen = keylen; 
    198203    entry->value = val; 
Note: See TracChangeset for help on using the changeset viewer.