Changeset 785

Show
Ignore:
Timestamp:
06/23/08 04:05:13 (17 months ago)
Author:
dormando
Message:

Use calloc for allocating the hash table vs. malloc+memset.

calloc is already used to resize the hash table, so it's good to be
consistent here.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/server/assoc.c

    r595 r785  
    477477 
    478478void assoc_init(void) { 
    479     unsigned int hash_size = hashsize(hashpower) * sizeof(void*); 
    480     primary_hashtable = malloc(hash_size); 
     479    primary_hashtable = calloc(hashsize(hashpower), sizeof(void *)); 
    481480    if (! primary_hashtable) { 
    482481        fprintf(stderr, "Failed to init hashtable.\n"); 
    483482        exit(EXIT_FAILURE); 
    484483    } 
    485     memset(primary_hashtable, 0, hash_size); 
    486484} 
    487485