summaryrefslogtreecommitdiff
path: root/conf/conf.h
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-05-25 23:30:39 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-05-25 23:30:39 +0200
commitb7761af34dc4ed3f1bdf874eb85d743b931b0af6 (patch)
tree20d65d244ec8655c0fa0e7457accd9ef6bac9b4f /conf/conf.h
parentc72b660b7423b0fb687794b722884cd6e5e6c562 (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 'conf/conf.h')
-rw-r--r--conf/conf.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/conf/conf.h b/conf/conf.h
index 41cb434f..bf74b76b 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -11,6 +11,7 @@
#include "lib/resource.h"
#include "lib/timer.h"
+#include "lib/hash.h"
/* Configuration structure */
@@ -50,8 +51,8 @@ struct config {
char *err_file_name; /* File name containing error */
char *file_name; /* Name of main configuration file */
int file_fd; /* File descriptor of main configuration file */
- struct symbol **sym_hash; /* Lexer: symbol hash table */
- struct symbol **sym_fallback; /* Lexer: fallback symbol hash table */
+ HASH(struct symbol) sym_hash; /* Lexer: symbol hash table */
+ struct config *fallback; /* Link to regular config for CLI parsing */
int obstacle_count; /* Number of items blocking freeing of this config */
int shutdown; /* This is a pseudo-config for daemon shutdown */
bird_clock_t load_time; /* When we've got this configuration */
@@ -112,6 +113,12 @@ struct symbol {
char name[1];
};
+struct sym_scope {
+ struct sym_scope *next; /* Next on scope stack */
+ struct symbol *name; /* Name of this scope */
+ int active; /* Currently entered */
+};
+
#define SYM_MAX_LEN 64
/* Remember to update cf_symbol_class_name() */
@@ -154,7 +161,6 @@ struct symbol *cf_default_name(char *template, int *counter);
struct symbol *cf_define_symbol(struct symbol *symbol, int type, void *def);
void cf_push_scope(struct symbol *);
void cf_pop_scope(void);
-struct symbol *cf_walk_symbols(struct config *cf, struct symbol *sym, int *pos);
char *cf_symbol_class_name(struct symbol *sym);
static inline int cf_symbol_is_constant(struct symbol *sym)