diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2018-10-24 06:01:04 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2018-10-24 06:01:04 +0000 |
commit | 9c43bb9a6fe71363ff1011073a34d18335e60eb5 (patch) | |
tree | 2044991f94596cdbefa5bd6533863c4a1969a62f /bin | |
parent | 2226ccdfa41b77b87a336ffea5306e124282b294 (diff) |
Fix some minor issues found by coverity.
OK millert@ and miko@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/csh/csh.c | 4 | ||||
-rw-r--r-- | bin/csh/dir.c | 4 | ||||
-rw-r--r-- | bin/csh/lex.c | 7 | ||||
-rw-r--r-- | bin/csh/misc.c | 9 | ||||
-rw-r--r-- | bin/csh/parse.c | 4 | ||||
-rw-r--r-- | bin/csh/set.c | 4 |
6 files changed, 15 insertions, 17 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c index 0bf879c8b5e..9709b7cdee6 100644 --- a/bin/csh/csh.c +++ b/bin/csh/csh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: csh.c,v 1.44 2018/09/08 01:28:39 miko Exp $ */ +/* $OpenBSD: csh.c,v 1.45 2018/10/24 06:01:03 martijn Exp $ */ /* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */ /*- @@ -578,7 +578,7 @@ importpath(Char *cp) * i+2 where i is the number of colons in the path. There are i+1 * directories in the path plus we need room for a zero terminator. */ - pv = (Char **) xcalloc((size_t) (i + 2), sizeof(Char **)); + pv = xcalloc(i + 2, sizeof(*pv)); dp = cp; i = 0; if (*dp) diff --git a/bin/csh/dir.c b/bin/csh/dir.c index 8a4caaf319b..16cec8ecfc1 100644 --- a/bin/csh/dir.c +++ b/bin/csh/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.22 2018/09/19 18:55:33 millert Exp $ */ +/* $OpenBSD: dir.c,v 1.23 2018/10/24 06:01:03 martijn Exp $ */ /* $NetBSD: dir.c,v 1.9 1995/03/21 09:02:42 cgd Exp $ */ /*- @@ -132,7 +132,7 @@ dset(Char *dp) * Don't call set() directly cause if the directory contains ` or * other junk characters glob will fail. */ - Char **vec = xreallocarray(NULL, 2, sizeof(Char **)); + Char **vec = xreallocarray(NULL, 2, sizeof(*vec)); vec[0] = Strsave(dp); vec[1] = 0; diff --git a/bin/csh/lex.c b/bin/csh/lex.c index 473ed428c39..974eeaf44e9 100644 --- a/bin/csh/lex.c +++ b/bin/csh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.29 2018/09/19 18:48:55 millert Exp $ */ +/* $OpenBSD: lex.c,v 1.30 2018/10/24 06:01:03 martijn Exp $ */ /* $NetBSD: lex.c,v 1.9 1995/09/27 00:38:46 jtc Exp $ */ /*- @@ -1408,8 +1408,7 @@ bgetc(void) again: buf = (int) fseekp / BUFSIZ; if (buf >= fblocks) { - Char **nfbuf = xcalloc((size_t) (fblocks + 2), - sizeof(Char **)); + Char **nfbuf = xcalloc(fblocks + 2, sizeof(*nfbuf)); if (fbuf) { (void) blkcpy(nfbuf, fbuf); @@ -1556,7 +1555,7 @@ settell(void) return; if (lseek(SHIN, (off_t) 0, SEEK_CUR) < 0 || errno == ESPIPE) return; - fbuf = xcalloc(2, sizeof(Char **)); + fbuf = xcalloc(2, sizeof(*fbuf)); fblocks = 1; fbuf[0] = xcalloc(BUFSIZ, sizeof(Char)); fseekp = fbobp = feobp = lseek(SHIN, (off_t) 0, SEEK_CUR); diff --git a/bin/csh/misc.c b/bin/csh/misc.c index c11765a2a31..d0964e03602 100644 --- a/bin/csh/misc.c +++ b/bin/csh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.24 2018/09/18 17:48:22 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.25 2018/10/24 06:01:03 martijn Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/03/21 09:03:09 cgd Exp $ */ /*- @@ -116,7 +116,7 @@ blkfree(Char **av0) Char ** saveblk(Char **v) { - Char **newv = xcalloc((size_t) (blklen(v) + 1), sizeof(Char **)); + Char **newv = xcalloc(blklen(v) + 1, sizeof(*newv)); Char **onewv = newv; while (*v) @@ -127,8 +127,7 @@ saveblk(Char **v) Char ** blkspl(Char **up, Char **vp) { - Char **wp = xcalloc((size_t) (blklen(up) + blklen(vp) + 1), - sizeof(Char **)); + Char **wp = xcalloc(blklen(up) + blklen(vp) + 1, sizeof(*wp)); (void) blkcpy(wp, up); return (blkcat(wp, vp)); @@ -290,7 +289,7 @@ number(Char *cp) Char ** copyblk(Char **v) { - Char **nv = xcalloc((size_t) (blklen(v) + 1), sizeof(Char **)); + Char **nv = xcalloc(blklen(v) + 1, sizeof(*nv)); return (blkcpy(nv, v)); } diff --git a/bin/csh/parse.c b/bin/csh/parse.c index 9b93e26569a..626d212d21a 100644 --- a/bin/csh/parse.c +++ b/bin/csh/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.14 2018/09/18 06:56:09 deraadt Exp $ */ +/* $OpenBSD: parse.c,v 1.15 2018/10/24 06:01:03 martijn Exp $ */ /* $NetBSD: parse.c,v 1.6 1995/03/21 09:03:10 cgd Exp $ */ /*- @@ -530,7 +530,7 @@ again: if (n < 0) n = 0; t = xcalloc(1, sizeof(*t)); - av = xcalloc((size_t) (n + 1), sizeof(Char **)); + av = xcalloc(n + 1, sizeof(*av)); t->t_dcom = av; n = 0; if (p2->word[0] == ')') diff --git a/bin/csh/set.c b/bin/csh/set.c index 1298121337c..954af95787b 100644 --- a/bin/csh/set.c +++ b/bin/csh/set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: set.c,v 1.21 2018/09/18 06:56:09 deraadt Exp $ */ +/* $OpenBSD: set.c,v 1.22 2018/10/24 06:01:03 martijn Exp $ */ /* $NetBSD: set.c,v 1.8 1995/03/21 18:35:52 mycroft Exp $ */ /*- @@ -401,7 +401,7 @@ adrof1(Char *name, struct varent *v) void set(Char *var, Char *val) { - Char **vec = xreallocarray(NULL, 2, sizeof(Char **)); + Char **vec = xreallocarray(NULL, 2, sizeof(*vec)); vec[0] = val; vec[1] = 0; |