]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Minor cleanups with cfg_allocz()
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 24 Nov 2020 03:09:11 +0000 (04:09 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 24 Nov 2020 03:09:11 +0000 (04:09 +0100)
Also fixes some more failed asserts due to add_tail().

conf/cf-lex.l
conf/confbase.Y
filter/tree.c
nest/config.Y

index 9ea05e9d9603b686a76ccf28a7c4b4cc2396becd..05288b1a54164ee06aac939c409ed9c9cc77700b 100644 (file)
@@ -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;
index f0343a9398ba991f2965ca5035a396efe54515cd..67dcac6c5c0453be9958a6d3b4f296e0d72a4b81 100644 (file)
@@ -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);
    }
index 46d6e529a2bdbe18fdbaea74c84626624dfc0b42..2bbc84bb1ce6706b2c631488e630382c6531edcc 100644 (file)
@@ -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;
 }
 
index 83f2c7ba9fe83e06c008a0ec96acb109edceb24e..ec7217b0a67b5331070607437c9d280fec4fbe7a 100644 (file)
@@ -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;