parse/htab.c
/* Creates a new empty hash table, using 'hash' as the
 * hash funciton, and 'cmp' to verify that there are no
 * hash collisions. */
Creates a new empty hash table, using 'hash' as the
hash funciton, and 'cmp' to verify that there are no
hash collisions.
Creates a new empty hash table using ' hash ' as the hash funciton and ' cmp ' to verify that there are no hash collisions .
Htab *mkht(ulong (*hash)(void *key), int (*cmp)(void *k1, void *k2))
{
    Htab *ht;
    ht = xalloc(sizeof(Htab));
    ht->nelt = 0;
    ht->ndead = 0;
    ht->sz = Initsz;
    ht->hash = hash;
    ht->cmp = cmp;
    ht->keys = zalloc(Initsz*sizeof(void*));
    ht->vals = zalloc(Initsz*sizeof(void*));
    ht->hashes = zalloc(Initsz*sizeof(void*));
    ht->dead = zalloc(Initsz*sizeof(char));
    return ht;
}
Htab * mkht ( ulong ( * hash ) ( void * key ) , int ( * cmp ) ( void * k1 , void * k2 ) ) { Htab * ht ; ht = xalloc ( sizeof ( Htab ) ) ; ht -> nelt = 0 ; ht -> ndead = 0 ; ht -> sz = Initsz ; ht -> hash = hash ; ht -> cmp = cmp ; ht -> keys = zalloc ( Initsz * sizeof ( void * ) ) ; ht -> vals = zalloc ( Initsz * sizeof ( void * ) ) ; ht -> hashes = zalloc ( Initsz * sizeof ( void * ) ) ; ht -> dead = zalloc ( Initsz * sizeof ( char ) ) ; return ht ; }
Creates a new empty hash table, using 'hash' as the
 hash funciton, and 'cmp' to verify that there are no
 hash collisions.
Creates a new empty hash table using ' hash ' as the hash funciton and ' cmp ' to verify that there are no hash collisions .