diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-05-25 23:30:39 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-05-25 23:30:39 +0200 |
commit | b7761af34dc4ed3f1bdf874eb85d743b931b0af6 (patch) | |
tree | 20d65d244ec8655c0fa0e7457accd9ef6bac9b4f /nest/cmds.c | |
parent | c72b660b7423b0fb687794b722884cd6e5e6c562 (diff) |
Conf: Replace keyword and symbol hash table with generic hash table.
The old hash table had fixed size, which makes it slow for config files
with large number of symbols and symbol lookups. The new one is growing
according to needs.
Diffstat (limited to 'nest/cmds.c')
-rw-r--r-- | nest/cmds.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/nest/cmds.c b/nest/cmds.c index 70fbdaf8..0bc9b9d1 100644 --- a/nest/cmds.c +++ b/nest/cmds.c @@ -46,22 +46,24 @@ cmd_show_status(void) void cmd_show_symbols(struct sym_show_data *sd) { - int pos = 0; - struct symbol *sym = sd->sym; - - if (sym) - cli_msg(1010, "%-8s\t%s", sym->name, cf_symbol_class_name(sym)); + if (sd->sym) + cli_msg(1010, "%-8s\t%s", sd->sym->name, cf_symbol_class_name(sd->sym)); else + { + HASH_WALK(config->sym_hash, next, sym) { - while (sym = cf_walk_symbols(config, sym, &pos)) - { - if (sd->type && (sym->class != sd->type)) - continue; - - cli_msg(-1010, "%-8s\t%s", sym->name, cf_symbol_class_name(sym)); - } - cli_msg(0, ""); + if (!sym->scope->active) + continue; + + if (sd->type && (sym->class != sd->type)) + continue; + + cli_msg(-1010, "%-8s\t%s", sym->name, cf_symbol_class_name(sym)); } + HASH_WALK_END; + + cli_msg(0, ""); + } } static void |