1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Merge commit '37b64441' into thread-next

This commit is contained in:
Maria Matejka
2022-11-07 10:28:01 +01:00
8 changed files with 36 additions and 18 deletions

View File

@@ -736,7 +736,7 @@ cf_lex_symbol(const char *data)
static void
cf_lex_init_kh(void)
{
HASH_INIT(kw_hash, &root_pool, KW_ORDER);
HASH_INIT(kw_hash, config_pool, KW_ORDER);
struct keyword *k;
for (k=keyword_list; k->name; k++)
@@ -864,7 +864,7 @@ cf_push_soft_scope(void)
if (conf_this_scope->soft_scopes < 0xfe)
conf_this_scope->soft_scopes++;
else
cf_push_scope(NULL);
cf_push_block_scope();
}
/**
@@ -878,7 +878,7 @@ cf_pop_soft_scope(void)
if (conf_this_scope->soft_scopes)
conf_this_scope->soft_scopes--;
else
cf_pop_scope();
cf_pop_block_scope();
}
/**
@@ -893,7 +893,7 @@ cf_swap_soft_scope(void)
if (conf_this_scope->soft_scopes)
{
conf_this_scope->soft_scopes--;
cf_push_scope(NULL);
cf_push_block_scope();
}
}

View File

@@ -61,6 +61,7 @@
static jmp_buf conf_jmpbuf;
struct config *config, *new_config;
pool *config_pool;
static struct config *old_config; /* Old configuration */
static struct config *future_config; /* New config held here if recon requested during recon */
@@ -89,7 +90,7 @@ int undo_available; /* Undo was not requested from last reconfiguration */
struct config *
config_alloc(const char *name)
{
pool *p = rp_new(&root_pool, "Config");
pool *p = rp_new(config_pool, "Config");
linpool *l = lp_new_default(p);
struct config *c = lp_allocz(l, sizeof(struct config));
@@ -489,10 +490,12 @@ config_timeout(timer *t UNUSED)
void
config_init(void)
{
config_event = ev_new(&root_pool);
config_pool = rp_new(&root_pool, "Configurations");
config_event = ev_new(config_pool);
config_event->hook = config_done;
config_timer = tm_new(&root_pool);
config_timer = tm_new(config_pool);
config_timer->hook = config_timeout;
}

View File

@@ -96,7 +96,7 @@ void order_shutdown(int gr);
/* Pools */
extern pool *config_pool;
extern linpool *cfg_mem;
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
@@ -137,6 +137,7 @@ struct sym_scope {
uint slots; /* Variable slots */
byte active; /* Currently entered */
byte block; /* No independent stack frame */
byte soft_scopes; /* Number of soft scopes above */
};
@@ -232,6 +233,12 @@ void cf_pop_scope(void);
void cf_push_soft_scope(void);
void cf_pop_soft_scope(void);
static inline void cf_push_block_scope(void)
{ cf_push_scope(NULL); conf_this_scope->block = 1; }
static inline void cf_pop_block_scope(void)
{ ASSERT(conf_this_scope->block); cf_pop_scope(); }
char *cf_symbol_class_name(struct symbol *sym);
/* Parser */

View File

@@ -180,7 +180,7 @@ flow6_opts:
flow_builder_init:
{
if (this_flow == NULL)
this_flow = flow_builder_init(&root_pool);
this_flow = flow_builder_init(config_pool); /* FIXME: This should be allocated from tmp in future */
else
flow_builder_clear(this_flow);
};