From 45cb29a2ada4edfc2b547fe023d923ce0299a61d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 8 Aug 2019 00:30:28 +0200 Subject: src: remove global symbol_table Store symbol tables in context object instead. Use the nft_ctx object to store the dynamic symbol table. Pass it on to the parse_ctx object so this can be accessed from the parse routines. This dynamic symbol table is also accesible from the output_ctx object for print routines. Signed-off-by: Pablo Neira Ayuso --- src/rt.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/rt.c') diff --git a/src/rt.c b/src/rt.c index cdd5e9d8..b19c44d6 100644 --- a/src/rt.c +++ b/src/rt.c @@ -24,27 +24,26 @@ #include #include -static struct symbol_table *realm_tbl; -void realm_table_rt_init(void) +void realm_table_rt_init(struct nft_ctx *ctx) { - realm_tbl = rt_symbol_table_init("/etc/iproute2/rt_realms"); + ctx->output.tbl.realm = rt_symbol_table_init("/etc/iproute2/rt_realms"); } -void realm_table_rt_exit(void) +void realm_table_rt_exit(struct nft_ctx *ctx) { - rt_symbol_table_free(realm_tbl); + rt_symbol_table_free(ctx->output.tbl.realm); } static void realm_type_print(const struct expr *expr, struct output_ctx *octx) { - return symbolic_constant_print(realm_tbl, expr, true, octx); + return symbolic_constant_print(octx->tbl.realm, expr, true, octx); } static struct error_record *realm_type_parse(struct parse_ctx *ctx, const struct expr *sym, struct expr **res) { - return symbolic_constant_parse(ctx, sym, realm_tbl, res); + return symbolic_constant_parse(ctx, sym, ctx->tbl->realm, res); } const struct datatype realm_type = { -- cgit v1.2.3