#include <config.h>
#include <ctype.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/symtab.h>
#include <isc/util.h>
Go to the source code of this file.
Data Structures | |
struct | elt |
Defines | |
#define | SYMTAB_MAGIC ISC_MAGIC('S', 'y', 'm', 'T') |
#define | VALID_SYMTAB(st) ISC_MAGIC_VALID(st, SYMTAB_MAGIC) |
#define | FIND(s, k, t, b, e) |
Typedefs | |
typedef struct elt | elt_t |
Functions | |
typedef | LIST (elt_t) |
isc_result_t | isc_symtab_create (isc_mem_t *mctx, unsigned int size, isc_symtabaction_t undefine_action, void *undefine_arg, isc_boolean_t case_sensitive, isc_symtab_t **symtabp) |
Create a symbol table. | |
void | isc_symtab_destroy (isc_symtab_t **symtabp) |
Destroy a symbol table. | |
static unsigned int | hash (const char *key, isc_boolean_t case_sensitive) |
isc_result_t | isc_symtab_lookup (isc_symtab_t *symtab, const char *key, unsigned int type, isc_symvalue_t *value) |
Lookup a symbol table. | |
static void | grow_table (isc_symtab_t *symtab) |
isc_result_t | isc_symtab_define (isc_symtab_t *symtab, const char *key, unsigned int type, isc_symvalue_t value, isc_symexists_t exists_policy) |
Define a symbol table. | |
isc_result_t | isc_symtab_undefine (isc_symtab_t *symtab, const char *key, unsigned int type) |
Undefine a symbol table. | |
unsigned int | isc_symtab_count (isc_symtab_t *symtab) |
Return the number of items in a symbol table. |
Definition in file symtab.c.
#define SYMTAB_MAGIC ISC_MAGIC('S', 'y', 'm', 'T') |
Referenced by isc_symtab_create(), and isccc_symtab_create().
#define VALID_SYMTAB | ( | st | ) | ISC_MAGIC_VALID(st, SYMTAB_MAGIC) |
#define FIND | ( | s, | |||
k, | |||||
t, | |||||
b, | |||||
e | ) |
Value:
b = hash((k), (s)->case_sensitive) % (s)->size; \ if ((s)->case_sensitive) { \ for (e = HEAD((s)->table[b]); e != NULL; e = NEXT(e, link)) { \ if (((t) == 0 || e->type == (t)) && \ strcmp(e->key, (k)) == 0) \ break; \ } \ } else { \ for (e = HEAD((s)->table[b]); e != NULL; e = NEXT(e, link)) { \ if (((t) == 0 || e->type == (t)) && \ strcasecmp(e->key, (k)) == 0) \ break; \ } \ }
Definition at line 153 of file symtab.c.
Referenced by isc_symtab_define(), isc_symtab_lookup(), isc_symtab_undefine(), isccc_symtab_define(), isccc_symtab_lookup(), and isccc_symtab_undefine().
isc_result_t isc_symtab_create | ( | isc_mem_t * | mctx, | |
unsigned int | size, | |||
isc_symtabaction_t | undefine_action, | |||
void * | undefine_arg, | |||
isc_boolean_t | case_sensitive, | |||
isc_symtab_t ** | symtabp | |||
) |
Create a symbol table.
Definition at line 58 of file symtab.c.
References INIT_LIST, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, ISC_R_NOMEMORY, ISC_R_SUCCESS, REQUIRE, symtab, and SYMTAB_MAGIC.
Referenced by add(), ATF_TC_BODY(), bind9_check_logging(), bind9_check_namedconf(), check_options(), check_viewconf(), create_map(), and validate_masters().
void isc_symtab_destroy | ( | isc_symtab_t ** | symtabp | ) |
Destroy a symbol table.
Definition at line 99 of file symtab.c.
References HEAD, isc_mem_put, isc_mem_putanddetach, elt::key, NEXT, REQUIRE, symtab, elt::type, VALID_SYMTAB, and elt::value.
Referenced by ATF_TC_BODY(), bind9_check_logging(), bind9_check_namedconf(), check_options(), check_viewconf(), free_map(), and validate_masters().
static unsigned int hash | ( | const char * | key, | |
isc_boolean_t | case_sensitive | |||
) | [inline, static] |
isc_result_t isc_symtab_lookup | ( | isc_symtab_t * | symtab, | |
const char * | key, | |||
unsigned int | type, | |||
isc_symvalue_t * | value | |||
) |
Lookup a symbol table.
Definition at line 170 of file symtab.c.
References FIND, ISC_R_NOTFOUND, ISC_R_SUCCESS, REQUIRE, VALID_SYMTAB, and elt::value.
Referenced by ATF_TC_BODY(), bind9_check_logging(), bind9_check_namedconf(), cfg_map_get(), cfg_parse_mapbody(), cfg_parser_mapadd(), cfg_print_mapbody(), check_keylist(), check_servers(), fileexist(), logged(), and nameexist().
static void grow_table | ( | isc_symtab_t * | symtab | ) | [static] |
Definition at line 191 of file symtab.c.
References APPEND, hash, HEAD, INIT_LIST, INSIST, isc_mem_get, isc_mem_put, elt::key, NEXT, REQUIRE, and UNLINK.
Referenced by isc_symtab_define().
isc_result_t isc_symtab_define | ( | isc_symtab_t * | symtab, | |
const char * | key, | |||
unsigned int | type, | |||
isc_symvalue_t | value, | |||
isc_symexists_t | exists_policy | |||
) |
Define a symbol table.
Definition at line 231 of file symtab.c.
References DE_CONST, FIND, grow_table(), INSIST, ISC_LINK_INIT, isc_mem_get, ISC_R_EXISTS, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_symexists_add, isc_symexists_reject, isc_symexists_replace, elt::key, PREPEND, REQUIRE, elt::type, UNLINK, VALID_SYMTAB, and elt::value.
Referenced by add(), ATF_TC_BODY(), bind9_check_logging(), bind9_check_namedconf(), cfg_parse_mapbody(), cfg_parser_mapadd(), check_keylist(), fileexist(), nameexist(), parse_symtab_elt(), and validate_masters().
isc_result_t isc_symtab_undefine | ( | isc_symtab_t * | symtab, | |
const char * | key, | |||
unsigned int | type | |||
) |
Undefine a symbol table.
Definition at line 283 of file symtab.c.
References FIND, isc_mem_put, ISC_R_NOTFOUND, ISC_R_SUCCESS, elt::key, REQUIRE, elt::type, UNLINK, VALID_SYMTAB, and elt::value.
Referenced by ATF_TC_BODY().
unsigned int isc_symtab_count | ( | isc_symtab_t * | symtab | ) |
Return the number of items in a symbol table.
Definition at line 306 of file symtab.c.
References REQUIRE, and VALID_SYMTAB.
Referenced by cfg_map_count().