diff options
author | delphij <delphij@FreeBSD.org> | 2006-06-07 01:43:26 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2006-06-07 01:43:26 +0000 |
commit | 65d304bb17eb3a675475dca1de8ce547a6651d5b (patch) | |
tree | 4def380021210fed9370419643b636082f3986aa /usr.sbin/config/config.y | |
parent | ec70ef58cb0b1e1ae85196811da2e42d64dac5a0 (diff) | |
download | FreeBSD-src-65d304bb17eb3a675475dca1de8ce547a6651d5b.zip FreeBSD-src-65d304bb17eb3a675475dca1de8ce547a6651d5b.tar.gz |
Use calloc() instead of zeroing the memory our own.
Diffstat (limited to 'usr.sbin/config/config.y')
-rw-r--r-- | usr.sbin/config/config.y | 12 |
1 files changed, 4 insertions, 8 deletions
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; |