Lines Matching refs:table
19 MM_Hash *table;
21 table = (MM_Hash *) mm_calloc(mm, 1, sizeof(MM_Hash));
22 table->mm = mm;
23 table->dtor = dtor;
25 return table;
28 void mm_hash_free(MM_Hash *table)
35 cur = table->buckets[i];
39 if (table->dtor) table->dtor(cur->data);
40 mm_free(table->mm, cur->key);
41 mm_free(table->mm, cur);
46 mm_free(table->mm, table);
59 void *mm_hash_find(MM_Hash *table, const void *key, int length)
64 for (b = table->buckets[ hash ]; b; b = b->next) {
75 void mm_hash_update(MM_Hash *table, char *key, int length, void *data)
82 for(b = table->buckets[ hash ]; b; b = b->next) {
86 if (table->dtor) table->dtor(b->data);
90 b = (MM_Bucket *) mm_malloc(table->mm, sizeof(MM_Bucket));
91 b->key = (char *) mm_malloc(table->mm, length + 1);
97 b->next = table->buckets[ hash ];
98 table->buckets[ hash ] = b;
100 table->nElements++;
103 void mm_hash_delete(MM_Hash *table, char *key, int length)
110 for (b = table->buckets[ hash ]; b; b = b->next) {
120 table->buckets[hash] = b->next;
123 if (table->dtor) table->dtor(b->data);
124 mm_free(table->mm, b->key);
125 mm_free(table->mm, b);