Lines Matching defs:symtab

23 /* $Id: symtab.c,v 1.11 2007/09/13 04:45:18 each Exp $ */
37 #include <isccc/symtab.h>
68 isccc_symtab_t *symtab;
74 symtab = malloc(sizeof(*symtab));
75 if (symtab == NULL)
77 symtab->table = malloc(size * sizeof(eltlist_t));
78 if (symtab->table == NULL) {
79 free(symtab);
83 ISC_LIST_INIT(symtab->table[i]);
84 symtab->size = size;
85 symtab->undefine_action = undefine_action;
86 symtab->undefine_arg = undefine_arg;
87 symtab->case_sensitive = case_sensitive;
88 symtab->magic = SYMTAB_MAGIC;
90 *symtabp = symtab;
96 free_elt(isccc_symtab_t *symtab, unsigned int bucket, elt_t *elt) {
97 ISC_LIST_UNLINK(symtab->table[bucket], elt, link);
98 if (symtab->undefine_action != NULL)
99 (symtab->undefine_action)(elt->key, elt->type, elt->value,
100 symtab->undefine_arg);
106 isccc_symtab_t *symtab;
111 symtab = *symtabp;
112 REQUIRE(VALID_SYMTAB(symtab));
114 for (i = 0; i < symtab->size; i++) {
115 for (elt = ISC_LIST_HEAD(symtab->table[i]);
119 free_elt(symtab, i, elt);
122 free(symtab->table);
123 symtab->magic = 0;
124 free(symtab);
186 isccc_symtab_lookup(isccc_symtab_t *symtab, const char *key, unsigned int type,
192 REQUIRE(VALID_SYMTAB(symtab));
195 FIND(symtab, key, type, bucket, elt);
207 isccc_symtab_define(isccc_symtab_t *symtab, char *key, unsigned int type,
213 REQUIRE(VALID_SYMTAB(symtab));
217 FIND(symtab, key, type, bucket, elt);
223 ISC_LIST_UNLINK(symtab->table[bucket], elt, link);
224 if (symtab->undefine_action != NULL)
225 (symtab->undefine_action)(elt->key, elt->type,
227 symtab->undefine_arg);
242 ISC_LIST_PREPEND(symtab->table[bucket], elt, link);
248 isccc_symtab_undefine(isccc_symtab_t *symtab, const char *key, unsigned int type) {
252 REQUIRE(VALID_SYMTAB(symtab));
255 FIND(symtab, key, type, bucket, elt);
260 free_elt(symtab, bucket, elt);
266 isccc_symtab_foreach(isccc_symtab_t *symtab, isccc_symtabforeachaction_t action,
272 REQUIRE(VALID_SYMTAB(symtab));
275 for (i = 0; i < symtab->size; i++) {
276 for (elt = ISC_LIST_HEAD(symtab->table[i]);
281 free_elt(symtab, i, elt);