summaryrefslogtreecommitdiff
path: root/bin/ksh/syn.c
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-11-01 15:38:54 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-11-01 15:38:54 +0000
commit2f377d9b3cef15535c39e411dac8e412ba13c38b (patch)
treee80195ce23082663928aafb335cafd2cfb874610 /bin/ksh/syn.c
parentff59124a026dd748c9d9f8ac96bb13115364103b (diff)
Add uses of areallocarray(). mksh and Bitrig ksh already have similar
functions. With help from Theo Buehler. ok nicm@
Diffstat (limited to 'bin/ksh/syn.c')
-rw-r--r--bin/ksh/syn.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/ksh/syn.c b/bin/ksh/syn.c
index 7c7183b0a9f..e55eb8a2227 100644
--- a/bin/ksh/syn.c
+++ b/bin/ksh/syn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syn.c,v 1.36 2015/10/19 14:42:16 mmcc Exp $ */
+/* $OpenBSD: syn.c,v 1.37 2015/11/01 15:38:53 mmcc Exp $ */
/*
* shell parser (C version)
@@ -197,8 +197,8 @@ get_command(int cf)
XPtrV args, vars;
struct nesting_state old_nesting;
- iops = alloc(sizeofN(struct ioword *, NUFILE+1),
- ATEMP);
+ iops = areallocarray(NULL, NUFILE + 1,
+ sizeof(struct ioword *), ATEMP);
XPinit(args, 16);
XPinit(vars, 16);
@@ -389,8 +389,8 @@ get_command(int cf)
t->ioact = NULL;
} else {
iops[iopn++] = NULL;
- iops = (struct ioword **) aresize((void*) iops,
- sizeofN(struct ioword *, iopn), ATEMP);
+ iops = areallocarray(iops, iopn,
+ sizeof(struct ioword *), ATEMP);
t->ioact = iops;
}
@@ -565,8 +565,8 @@ function_body(char *name,
* be used as input), we pretend there is a colon here.
*/
t->left = newtp(TCOM);
- t->left->args = alloc(sizeof(char *) * 2, ATEMP);
- t->left->args[0] = alloc(sizeof(char) * 3, ATEMP);
+ t->left->args = areallocarray(NULL, 2, sizeof(char *), ATEMP);
+ t->left->args[0] = alloc(3, ATEMP);
t->left->args[0][0] = CHAR;
t->left->args[0][1] = ':';
t->left->args[0][2] = EOS;