1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * htinit() returns a pointer to a new hash table, or a null pointer if
   9:  * out of memory.
  10:  */
  11: #include "null.h"
  12: #include "hash.h"
  13: 
  14: HASH *
  15: htinit(hashsiz)
  16:     unsigned int hashsiz;       /* hash table size */
  17: {
  18:     char *calloc();         /* memory allocator + zero init */
  19:     char *malloc();         /* memory allocator */
  20:     HASH *ht;           /* pointer to hash table struct */
  21:     HASHBLK **pt;           /* pointer to hash pointer table */
  22: 
  23:     if ((ht = (HASH *) malloc(sizeof(HASH))) == NULL ||
  24:         (pt = (HASHBLK **) calloc(hashsiz, sizeof(HASHBLK *))) == NULL)
  25:         {
  26:         warn("out of memory");
  27:         return(NULL);
  28:         }
  29:     ht->hashtab = pt;
  30:     ht->hashsiz = hashsiz;
  31:     return(ht);
  32: }

Defined functions

htinit defined in line 14; never used
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 559
Valid CSS Valid XHTML 1.0 Strict