Home | History | Annotate | Download | only in src

Lines Matching refs: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;
107 symtab_t *symtab = datum->symtab;
109 if (symtab == NULL) {
113 hashtab_remove(symtab->table, datum->name, NULL, NULL);
114 datum->symtab = NULL;
117 int cil_symtab_get_datum(symtab_t *symtab, char *key, struct cil_symtab_datum **datum)
119 *datum = (struct cil_symtab_datum*)hashtab_search(symtab->table, (hashtab_key_t)key);
127 int cil_symtab_map(symtab_t *symtab,
131 return hashtab_map(symtab->table, apply, args);
137 datum->symtab = NULL;
141 void cil_symtab_destroy(symtab_t *symtab)
143 if (symtab->table != NULL){
144 cil_symtab_map(symtab, __cil_symtab_destroy_helper, NULL);
145 hashtab_destroy(symtab->table);
146 symtab->table = NULL;
156 void cil_complex_symtab_init(struct cil_complex_symtab *symtab, unsigned int size)
158 symtab->htable = cil_calloc(size, sizeof(struct cil_complex_symtab *));
160 symtab->nelems = 0;
161 symtab->nslots = size;
162 symtab->mask = size - 1;
165 int cil_complex_symtab_insert(struct cil_complex_symtab *symtab,
180 cil_complex_symtab_hash(ckey, symtab->mask, &hash);
182 for (prev = NULL, curr = symtab->htable[hash]; curr != NULL;
214 node->next = symtab->htable[hash];
215 symtab->htable[hash] = node;
218 symtab->nelems++;
223 void cil_complex_symtab_search(struct cil_complex_symtab *symtab,
230 cil_complex_symtab_hash(ckey, symtab->mask, &hash);
231 for (curr = symtab->htable[hash]; curr != NULL; curr = curr->next) {
262 void cil_complex_symtab_destroy(struct cil_complex_symtab *symtab)
268 if (symtab == NULL) {
272 for (i = 0; i < symtab->nslots; i++) {
273 curr = symtab->htable[i];
279 symtab->htable[i] = NULL;
281 free(symtab->htable);
282 symtab->htable = NULL;
283 symtab->nelems = 0;
284 symtab->nslots = 0;
285 symtab->mask = 0;