From 65d304bb17eb3a675475dca1de8ce547a6651d5b Mon Sep 17 00:00:00 2001 From: delphij Date: Wed, 7 Jun 2006 01:43:26 +0000 Subject: Use calloc() instead of zeroing the memory our own. --- usr.sbin/config/config.y | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'usr.sbin/config/config.y') diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 770833d..adb6ff4 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -154,8 +154,7 @@ Config_spec: CPU Save_id = { struct cputype *cp = - (struct cputype *)malloc(sizeof (struct cputype)); - memset(cp, 0, sizeof(*cp)); + (struct cputype *)calloc(1, sizeof (struct cputype)); cp->cpu_name = $2; SLIST_INSERT_HEAD(&cputype, cp, cpu_next); } | @@ -336,8 +335,7 @@ newfile(char *name) { struct files_name *nl; - nl = (struct files_name *) malloc(sizeof *nl); - bzero(nl, sizeof *nl); + nl = (struct files_name *) calloc(1, sizeof *nl); nl->f_name = name; STAILQ_INSERT_TAIL(&fntab, nl, f_next); } @@ -370,8 +368,7 @@ newdev(char *name) return; } - np = (struct device *) malloc(sizeof *np); - memset(np, 0, sizeof(*np)); + np = (struct device *) calloc(1, sizeof *np); np->d_name = name; STAILQ_INSERT_TAIL(&dtab, np, d_next); } @@ -420,8 +417,7 @@ newopt(struct opt_head *list, char *name, char *value) return; } - op = (struct opt *)malloc(sizeof (struct opt)); - memset(op, 0, sizeof(*op)); + op = (struct opt *)calloc(1, sizeof (struct opt)); op->op_name = name; op->op_ownfile = 0; op->op_value = value; -- cgit v1.1