Lines Matching refs:tab
37 hashlook(register Hash_table_t* tab, const char* name, long flags, const char* value)
62 HASHMOD(tab, n);
63 for (b = tab->table[n]; b; b = b->next)
70 if (!(tab = tab->scope) || (flags & HASH_NOSCOPE))
75 tab->root->accesses++;
76 top = tab;
77 last = &tab->root->last;
80 last->table = tab;
89 else if (tab->flags & HASH_HASHED)
95 else HASH(tab->root, name, n);
99 HASHMOD(tab, n);
100 for (prev = 0, b = tab->table[n]; b; prev = b, b = b->next)
104 if (!tab->root->local->compare)
109 if (tab->root->namesize)
111 register char* s3 = s1 + tab->root->namesize;
119 else if (tab->root->namesize)
121 if (!(*tab->root->local->compare)(hashname(b), name, tab->root->namesize)) goto found;
123 else if (!(*tab->root->local->compare)(hashname(b), name)) goto found;
125 tab->root->collisions++;
127 if (!tab->scope || (flags & (HASH_CREATE|HASH_INSTALL|HASH_NOSCOPE)) == HASH_NOSCOPE) break;
128 tab = tab->scope;
134 tab = last->table;
138 HASHMOD(tab, n);
146 if (prev && !tab->frozen)
153 b->next = tab->table[n];
154 tab->table[n] = b;
161 if (tab != top && !(flags & HASH_SCOPE)) break;
167 if (tab == top || (flags & HASH_SCOPE))
170 else if (!(tab->root->flags & HASH_BUCKET))
172 if (tab->root->local->free && b->value)
174 (*tab->root->local->free)(b->value);
177 else if (tab->flags & HASH_VALUE)
183 tab->buckets--;
184 if (tab->frozen || (b->hash & HASH_OPAQUED)) b->hash |= HASH_DELETED;
187 tab->table[n] = b->next;
189 if (tab->root->local->free && (tab->root->flags & HASH_BUCKET)) (*tab->root->local->free)((char*)b);
192 if (tab->root->local->region) (*tab->root->local->region)(tab->root->local->handle, b, 0, 0);
197 if (tab->root->local->region) (*tab->root->local->region)(tab->root->local->handle, (char*)name, 0, 0);
205 if (tab != top || tab->frozen || (b->hash & (HASH_KEEP|HASH_OPAQUED)) || hashlook(top, value, (flags&(HASH_HASHED|HASH_INTERNAL))|HASH_LOOKUP, NiL))
208 if (!(tab->flags & HASH_ALLOCATE)) b->name = (char*)value;
209 else if (b->name && tab->root->namesize)
211 memcpy(b->name, value, tab->root->namesize);
219 if (!(i = tab->bucketsize))
231 if (!(t = tab->root->local->region ? (char*)(*tab->root->local->region)(tab->root->local->handle, NiL, m, 0) : (char*)malloc(m)))
239 if (tab->root->local->region) (*tab->root->local->region)(tab->root->local->handle, (char*)name, 0, 0);
242 tab->buckets--;
243 tab->table[n] = b->next;
262 if (tab == top) prev = 0;
270 if (!(flags & HASH_SCOPE)) tab = top;
277 if (!tab->frozen && !(tab->flags & HASH_FIXED) && tab->buckets > tab->root->meanchain * tab->size)
278 hashsize(tab, tab->size << 1);
286 int m = tab->bucketsize * sizeof(char*);
290 tab->flags |= HASH_VALUE;
293 tab->bucketsize = (sizeof(Hash_bucket_t) + sizeof(char*) - 1) / sizeof(char*);
294 m = tab->bucketsize * sizeof(char*);
304 if (!prev && (tab->flags & HASH_ALLOCATE))
306 m = tab->root->namesize ? tab->root->namesize : strlen(name) + 1;
307 if (tab->root->local->region)
309 if (!(b = (Hash_bucket_t*)(*tab->root->local->region)(tab->root->local->handle, NiL, n + m, 0)))
320 if (tab->root->local->region)
322 if (!(b = (Hash_bucket_t*)(*tab->root->local->region)(tab->root->local->handle, NiL, n, 0)))
332 HASHMOD(tab, n);
333 b->next = tab->table[n];
334 tab->table[n] = b;
335 tab->buckets++;
338 tab->buckets--;
351 tab->buckets++;
354 last->table = tab;
358 if (tab->root->local->free && !(tab->root->flags & HASH_BUCKET) && b->value) (*tab->root->local->free)(b->value);
359 if (value && tab->root->local->alloc) value = (*tab->root->local->alloc)((unsigned int)integralof(value));