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/mkoptions.c | |
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/mkoptions.c')
-rw-r--r-- | usr.sbin/config/mkoptions.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index d757815..c4bd624 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -69,8 +69,7 @@ options(void) /* Fake the cpu types as options. */ SLIST_FOREACH(cp, &cputype, cpu_next) { - op = (struct opt *)malloc(sizeof(*op)); - memset(op, 0, sizeof(*op)); + op = (struct opt *)calloc(1, sizeof(*op)); op->op_name = ns(cp->cpu_name); SLIST_INSERT_HEAD(&opt, op, op_next); } @@ -84,8 +83,7 @@ options(void) printf("warning: maxusers > %d (%d)\n", users.u_max, maxusers); /* Fake MAXUSERS as an option. */ - op = (struct opt *)malloc(sizeof(*op)); - memset(op, 0, sizeof(*op)); + op = (struct opt *)calloc(1, sizeof(*op)); op->op_name = ns("MAXUSERS"); snprintf(buf, sizeof(buf), "%d", maxusers); op->op_value = ns(buf); @@ -200,8 +198,7 @@ do_option(char *name) inw, basefile, ol->o_file); tidy++; } else { - op = (struct opt *) malloc(sizeof *op); - bzero(op, sizeof(*op)); + op = (struct opt *) calloc(1, sizeof *op); op->op_name = inw; op->op_value = invalue; SLIST_INSERT_HEAD(&op_head, op, op_next); @@ -227,8 +224,7 @@ do_option(char *name) if (value && !seen) { /* New option appears */ - op = (struct opt *) malloc(sizeof *op); - bzero(op, sizeof(*op)); + op = (struct opt *) calloc(1, sizeof *op); op->op_name = ns(name); op->op_value = value ? ns(value) : NULL; SLIST_INSERT_HEAD(&op_head, op, op_next); @@ -339,8 +335,7 @@ next: } } - po = (struct opt_list *) malloc(sizeof *po); - bzero(po, sizeof(*po)); + po = (struct opt_list *) calloc(1, sizeof *po); po->o_name = this; po->o_file = val; SLIST_INSERT_HEAD(&otab, po, o_next); |