From: Arnaud Lacombe Date: Mon, 20 Sep 2010 02:45:00 +0000 (-0400) Subject: kconfig: use calloc() for expr allocation X-Git-Tag: upstream/snapshot3+hdmi~9423^2~7^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8494453ad50599b0c9d099a230e423a89222ad08;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git kconfig: use calloc() for expr allocation Signed-off-by: Arnaud Lacombe --- diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 792c62e..290ce41 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -13,8 +13,7 @@ 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; @@ -22,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) 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; @@ -31,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) 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; @@ -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;