summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-11-24 04:09:11 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-11-24 04:09:11 +0100
commit30b846826905b4da76f59a212a31928bd55e9783 (patch)
treeb8dcc75f7e76a71df397ed240e826fdefaebf0fb
parent1678bc07467e6d977fc2f6bf830274ca92e0a6e5 (diff)
Minor cleanups with cfg_allocz()
Also fixes some more failed asserts due to add_tail().
-rw-r--r--conf/cf-lex.l2
-rw-r--r--conf/confbase.Y2
-rw-r--r--filter/tree.c7
-rw-r--r--nest/config.Y4
4 files changed, 5 insertions, 10 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index 9ea05e9d..05288b1a 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -737,7 +737,7 @@ cf_lex_init(int is_cli, struct config *c)
void
cf_push_scope(struct symbol *sym)
{
- struct sym_scope *s = cfg_alloc(sizeof(struct sym_scope));
+ struct sym_scope *s = cfg_allocz(sizeof(struct sym_scope));
s->next = conf_this_scope;
conf_this_scope = s;
diff --git a/conf/confbase.Y b/conf/confbase.Y
index f0343a93..67dcac6c 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -148,7 +148,7 @@ conf: definition ;
definition:
DEFINE symbol '=' term ';' {
- struct f_val *val = cfg_alloc(sizeof(struct f_val));
+ struct f_val *val = cfg_allocz(sizeof(struct f_val));
if (f_eval(f_linearize($4), cfg_mem, val) > F_RETURN) cf_error("Runtime error");
cf_define_symbol($2, SYM_CONSTANT | val->type, val, val);
}
diff --git a/filter/tree.c b/filter/tree.c
index 46d6e529..2bbc84bb 100644
--- a/filter/tree.c
+++ b/filter/tree.c
@@ -103,12 +103,7 @@ build_tree(struct f_tree *from)
struct f_tree *
f_new_tree(void)
{
- struct f_tree * ret;
- ret = cfg_alloc(sizeof(struct f_tree));
- ret->left = ret->right = NULL;
- ret->from.type = ret->to.type = T_VOID;
- ret->from.val.i = ret->to.val.i = 0;
- ret->data = NULL;
+ struct f_tree *ret = cfg_allocz(sizeof(struct f_tree));
return ret;
}
diff --git a/nest/config.Y b/nest/config.Y
index 83f2c7ba..ec7217b0 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -479,11 +479,11 @@ password_item:
password_item_begin:
PASSWORD text {
if (!this_p_list) {
- this_p_list = cfg_alloc(sizeof(list));
+ this_p_list = cfg_allocz(sizeof(list));
init_list(this_p_list);
password_id = 1;
}
- this_p_item = cfg_alloc(sizeof (struct password_item));
+ this_p_item = cfg_allocz(sizeof(struct password_item));
this_p_item->password = $2;
this_p_item->length = strlen($2);
this_p_item->genfrom = 0;