Skip to content

Commit

Permalink
kconfig: use calloc() for expr allocation
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
  • Loading branch information
lacombar committed Jul 2, 2011
1 parent 1ea3ad4 commit 8494453
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions scripts/kconfig/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,23 @@

struct expr *expr_alloc_symbol(struct symbol *sym)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = calloc(1, sizeof(*e));
e->type = E_SYMBOL;
e->left.sym = sym;
return e;
}

struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = calloc(1, sizeof(*e));
e->type = type;
e->left.expr = ce;
return e;
}

struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = calloc(1, sizeof(*e));
e->type = type;
e->left.expr = e1;
e->right.expr = e2;
Expand All @@ -41,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e

struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = calloc(1, sizeof(*e));
e->type = type;
e->left.sym = s1;
e->right.sym = s2;
Expand Down

0 comments on commit 8494453

Please sign in to comment.