• Home
  • Raw
  • Download

Lines Matching refs:htab

24 static struct hsearch_data htab;  variable
40 static int resize(size_t nel, struct hsearch_data *htab) in resize() argument
45 ENTRY *oldtab = htab->__tab->entries; in resize()
46 ENTRY *oldend = htab->__tab->entries + htab->__tab->mask + 1; in resize()
51 htab->__tab->entries = calloc(newsize, sizeof *htab->__tab->entries); in resize()
52 if (!htab->__tab->entries) { in resize()
53 htab->__tab->entries = oldtab; in resize()
56 htab->__tab->mask = newsize - 1; in resize()
62 newe = htab->__tab->entries + (i & htab->__tab->mask); in resize()
74 return __hcreate_r(nel, &htab); in hcreate()
79 __hdestroy_r(&htab); in hdestroy()
82 static ENTRY *lookup(char *key, size_t hash, struct hsearch_data *htab) in lookup() argument
88 e = htab->__tab->entries + (i & htab->__tab->mask); in lookup()
99 __hsearch_r(item, action, &e, &htab); in hsearch()
103 static int __hcreate_r(size_t nel, struct hsearch_data *htab) in __hcreate_r() argument
107 htab->__tab = calloc(1, sizeof *htab->__tab); in __hcreate_r()
108 if (!htab->__tab) in __hcreate_r()
110 r = resize(nel, htab); in __hcreate_r()
112 free(htab->__tab); in __hcreate_r()
113 htab->__tab = 0; in __hcreate_r()
119 static void __hdestroy_r(struct hsearch_data *htab) in __hdestroy_r() argument
121 if (htab->__tab) free(htab->__tab->entries); in __hdestroy_r()
122 free(htab->__tab); in __hdestroy_r()
123 htab->__tab = 0; in __hdestroy_r()
127 static int __hsearch_r(ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab) in __hsearch_r() argument
130 ENTRY *e = lookup(item.key, hash, htab); in __hsearch_r()
141 if (++htab->__tab->used > htab->__tab->mask - htab->__tab->mask/4) { in __hsearch_r()
142 if (!resize(2*htab->__tab->used, htab)) { in __hsearch_r()
143 htab->__tab->used--; in __hsearch_r()
148 e = lookup(item.key, hash, htab); in __hsearch_r()