Lines Matching refs:symtab
54 void cil_symtab_init(symtab_t *symtab, unsigned int size) in cil_symtab_init() argument
56 int rc = symtab_init(symtab, size); in cil_symtab_init()
66 datum->symtab = NULL; in cil_symtab_datum_init()
88 int cil_symtab_insert(symtab_t *symtab, hashtab_key_t key, struct cil_symtab_datum *datum, struct c… in cil_symtab_insert() argument
90 int rc = hashtab_insert(symtab->table, key, (hashtab_datum_t)datum); in cil_symtab_insert()
94 datum->symtab = symtab; in cil_symtab_insert()
107 symtab_t *symtab = datum->symtab; in cil_symtab_remove_datum() local
109 if (symtab == NULL) { in cil_symtab_remove_datum()
113 hashtab_remove(symtab->table, datum->name, NULL, NULL); in cil_symtab_remove_datum()
114 datum->symtab = NULL; in cil_symtab_remove_datum()
117 int cil_symtab_get_datum(symtab_t *symtab, char *key, struct cil_symtab_datum **datum) in cil_symtab_get_datum() argument
119 *datum = (struct cil_symtab_datum*)hashtab_search(symtab->table, (hashtab_key_t)key); in cil_symtab_get_datum()
127 int cil_symtab_map(symtab_t *symtab, in cil_symtab_map() argument
131 return hashtab_map(symtab->table, apply, args); in cil_symtab_map()
137 datum->symtab = NULL; in __cil_symtab_destroy_helper()
141 void cil_symtab_destroy(symtab_t *symtab) in cil_symtab_destroy() argument
143 if (symtab->table != NULL){ in cil_symtab_destroy()
144 cil_symtab_map(symtab, __cil_symtab_destroy_helper, NULL); in cil_symtab_destroy()
145 hashtab_destroy(symtab->table); in cil_symtab_destroy()
146 symtab->table = NULL; in cil_symtab_destroy()
156 void cil_complex_symtab_init(struct cil_complex_symtab *symtab, unsigned int size) in cil_complex_symtab_init() argument
158 symtab->htable = cil_calloc(size, sizeof(struct cil_complex_symtab *)); in cil_complex_symtab_init()
160 symtab->nelems = 0; in cil_complex_symtab_init()
161 symtab->nslots = size; in cil_complex_symtab_init()
162 symtab->mask = size - 1; in cil_complex_symtab_init()
165 int cil_complex_symtab_insert(struct cil_complex_symtab *symtab, in cil_complex_symtab_insert() argument
180 cil_complex_symtab_hash(ckey, symtab->mask, &hash); in cil_complex_symtab_insert()
182 for (prev = NULL, curr = symtab->htable[hash]; curr != NULL; in cil_complex_symtab_insert()
215 node->next = symtab->htable[hash]; in cil_complex_symtab_insert()
216 symtab->htable[hash] = node; in cil_complex_symtab_insert()
219 symtab->nelems++; in cil_complex_symtab_insert()
224 void cil_complex_symtab_search(struct cil_complex_symtab *symtab, in cil_complex_symtab_search() argument
231 cil_complex_symtab_hash(ckey, symtab->mask, &hash); in cil_complex_symtab_search()
232 for (curr = symtab->htable[hash]; curr != NULL; curr = curr->next) { in cil_complex_symtab_search()
263 void cil_complex_symtab_destroy(struct cil_complex_symtab *symtab) in cil_complex_symtab_destroy() argument
269 if (symtab == NULL) { in cil_complex_symtab_destroy()
273 for (i = 0; i < symtab->nslots; i++) { in cil_complex_symtab_destroy()
274 curr = symtab->htable[i]; in cil_complex_symtab_destroy()
280 symtab->htable[i] = NULL; in cil_complex_symtab_destroy()
282 free(symtab->htable); in cil_complex_symtab_destroy()
283 symtab->htable = NULL; in cil_complex_symtab_destroy()
284 symtab->nelems = 0; in cil_complex_symtab_destroy()
285 symtab->nslots = 0; in cil_complex_symtab_destroy()
286 symtab->mask = 0; in cil_complex_symtab_destroy()