Lines Matching defs:symtab
36 #include <sepol/policydb/symtab.h>
54 void cil_symtab_init(symtab_t *symtab, unsigned int size)
56 int rc = symtab_init(symtab, size);
58 cil_symtab_error("Failed to create symtab\n");
66 datum->symtab = NULL;
86 /* This both initializes the datum and inserts it into the symtab.
88 int cil_symtab_insert(symtab_t *symtab, hashtab_key_t key, struct cil_symtab_datum *datum, struct cil_tree_node *node)
90 int rc = hashtab_insert(symtab->table, key, (hashtab_datum_t)datum);
94 datum->symtab = symtab;
95 symtab->nprim++;
108 symtab_t *symtab = datum->symtab;
110 if (symtab == NULL) {
114 hashtab_remove(symtab->table, datum->name, NULL, NULL);
115 symtab->nprim--;
116 datum->symtab = NULL;
119 int cil_symtab_get_datum(symtab_t *symtab, char *key, struct cil_symtab_datum **datum)
121 *datum = (struct cil_symtab_datum*)hashtab_search(symtab->table, (hashtab_key_t)key);
129 int cil_symtab_map(symtab_t *symtab,
133 return hashtab_map(symtab->table, apply, args);
139 datum->symtab = NULL;
143 void cil_symtab_destroy(symtab_t *symtab)
145 if (symtab->table != NULL){
146 cil_symtab_map(symtab, __cil_symtab_destroy_helper, NULL);
147 hashtab_destroy(symtab->table);
148 symtab->table = NULL;
158 void cil_complex_symtab_init(struct cil_complex_symtab *symtab, unsigned int size)
160 symtab->htable = cil_calloc(size, sizeof(struct cil_complex_symtab *));
162 symtab->nelems = 0;
163 symtab->nslots = size;
164 symtab->mask = size - 1;
167 int cil_complex_symtab_insert(struct cil_complex_symtab *symtab,
182 cil_complex_symtab_hash(ckey, symtab->mask, &hash);
184 for (prev = NULL, curr = symtab->htable[hash]; curr != NULL;
217 node->next = symtab->htable[hash];
218 symtab->htable[hash] = node;
221 symtab->nelems++;
226 void cil_complex_symtab_search(struct cil_complex_symtab *symtab,
233 cil_complex_symtab_hash(ckey, symtab->mask, &hash);
234 for (curr = symtab->htable[hash]; curr != NULL; curr = curr->next) {
265 void cil_complex_symtab_destroy(struct cil_complex_symtab *symtab)
271 if (symtab == NULL) {
275 for (i = 0; i < symtab->nslots; i++) {
276 curr = symtab->htable[i];
282 symtab->htable[i] = NULL;
284 free(symtab->htable);
285 symtab->htable = NULL;
286 symtab->nelems = 0;
287 symtab->nslots = 0;
288 symtab->mask = 0;