diff options
author | miko <miko@cvs.openbsd.org> | 2018-09-08 01:28:40 +0000 |
---|---|---|
committer | miko <miko@cvs.openbsd.org> | 2018-09-08 01:28:40 +0000 |
commit | e432ef2c7188307628d28126b5f3adda114e2d6d (patch) | |
tree | 76c2be051f403af54bd5fec25d3def161fac21a6 /bin/csh | |
parent | 4c3475c2990afd050591a1b4f7487c5a3863e71f (diff) |
blkfree() takes no action for NULL pointer so callers can avoid checking.
ok jca@
Diffstat (limited to 'bin/csh')
-rw-r--r-- | bin/csh/csh.c | 11 | ||||
-rw-r--r-- | bin/csh/dol.c | 6 | ||||
-rw-r--r-- | bin/csh/error.c | 11 | ||||
-rw-r--r-- | bin/csh/func.c | 13 | ||||
-rw-r--r-- | bin/csh/glob.c | 6 | ||||
-rw-r--r-- | bin/csh/proc.c | 6 |
6 files changed, 24 insertions, 29 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c index 4971cf04303..0bf879c8b5e 100644 --- a/bin/csh/csh.c +++ b/bin/csh/csh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: csh.c,v 1.43 2017/12/16 10:27:21 anton Exp $ */ +/* $OpenBSD: csh.c,v 1.44 2018/09/08 01:28:39 miko Exp $ */ /* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */ /*- @@ -885,7 +885,6 @@ pintr(int notused) void pintr1(bool wantnl) { - Char **v; sigset_t sigset, osigset; sigemptyset(&sigset); @@ -914,10 +913,10 @@ pintr1(bool wantnl) if (gointr) { gotolab(gointr); timflg = 0; - if ((v = pargv) != NULL) - pargv = 0, blkfree(v); - if ((v = gargv) != NULL) - gargv = 0, blkfree(v); + blkfree(pargv); + pargv = NULL; + blkfree(gargv); + gargv = NULL; reset(); } else if (intty && wantnl) { diff --git a/bin/csh/dol.c b/bin/csh/dol.c index 95b24558643..593b1ba3e88 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dol.c,v 1.21 2017/12/16 10:27:21 anton Exp $ */ +/* $OpenBSD: dol.c,v 1.22 2018/09/08 01:28:39 miko Exp $ */ /* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */ /*- @@ -952,7 +952,7 @@ heredoc(Char *term) ocnt = BUFSIZ; } } - if (pargv) - blkfree(pargv), pargv = 0; + blkfree(pargv); + pargv = NULL; } } diff --git a/bin/csh/error.c b/bin/csh/error.c index 9f41b741da2..723a6213485 100644 --- a/bin/csh/error.c +++ b/bin/csh/error.c @@ -1,4 +1,4 @@ -/* $OpenBSD: error.c,v 1.13 2017/12/16 10:27:21 anton Exp $ */ +/* $OpenBSD: error.c,v 1.14 2018/09/08 01:28:39 miko Exp $ */ /* $NetBSD: err.c,v 1.6 1995/03/21 09:02:47 cgd Exp $ */ /*- @@ -315,7 +315,6 @@ void stderror(int id, ...) { va_list va; - Char **v; int flags = id & ERR_FLAGS; id &= ~ERR_FLAGS; @@ -349,10 +348,10 @@ stderror(int id, ...) free(seterr); seterr = NULL; - if ((v = pargv) != NULL) - pargv = 0, blkfree(v); - if ((v = gargv) != NULL) - gargv = 0, blkfree(v); + blkfree(pargv); + pargv = NULL; + blkfree(gargv); + gargv = NULL; (void) fflush(cshout); (void) fflush(csherr); diff --git a/bin/csh/func.c b/bin/csh/func.c index 18707bf8084..b34874328f4 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -1,4 +1,4 @@ -/* $OpenBSD: func.c,v 1.37 2017/12/18 19:12:24 anton Exp $ */ +/* $OpenBSD: func.c,v 1.38 2018/09/08 01:28:39 miko Exp $ */ /* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */ /*- @@ -822,8 +822,7 @@ wfree(void) } } - if (wp->w_fe0) - blkfree(wp->w_fe0); + blkfree(wp->w_fe0); free(wp->w_fename); free(wp); } @@ -886,8 +885,8 @@ xecho(int sep, Char **v) (void) fflush(cshout); if (setintr) sigprocmask(SIG_BLOCK, &sigset, NULL); - if (gargv) - blkfree(gargv), gargv = 0; + blkfree(gargv); + gargv = NULL; } void @@ -1373,8 +1372,8 @@ doeval(Char **v, struct command *t) SHIN = dmove(saveIN, oSHIN); SHOUT = dmove(saveOUT, oSHOUT); SHERR = dmove(saveERR, oSHERR); - if (gv) - blkfree(gv), gv = NULL; + blkfree(gv); + gv = NULL; resexit(osetexit); gv = savegv; if (my_reenter) diff --git a/bin/csh/glob.c b/bin/csh/glob.c index 6dc529580ac..d21cd7c5bbc 100644 --- a/bin/csh/glob.c +++ b/bin/csh/glob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glob.c,v 1.22 2015/12/26 13:48:38 mestre Exp $ */ +/* $OpenBSD: glob.c,v 1.23 2018/09/08 01:28:39 miko Exp $ */ /* $NetBSD: glob.c,v 1.10 1995/03/21 09:03:01 cgd Exp $ */ /*- @@ -578,9 +578,7 @@ dobackp(Char *cp, bool literal) Char *lp, *rp; Char *ep, word[PATH_MAX]; - if (pargv) { - blkfree(pargv); - } + blkfree(pargv); pargsiz = GLOBSPACE; pargv = xreallocarray(NULL, pargsiz, sizeof(Char *)); pargv[0] = NULL; diff --git a/bin/csh/proc.c b/bin/csh/proc.c index 3accda9ff7c..12bf6ee47af 100644 --- a/bin/csh/proc.c +++ b/bin/csh/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.31 2017/07/22 09:37:21 anton Exp $ */ +/* $OpenBSD: proc.c,v 1.32 2018/09/08 01:28:39 miko Exp $ */ /* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */ /*- @@ -1073,8 +1073,8 @@ pkill(Char **v, int signum) cont: v++; } - if (gargv) - blkfree(gargv), gargv = 0; + blkfree(gargv); + gargv = NULL; sigprocmask(SIG_UNBLOCK, &sigset, NULL); if (err1) stderror(ERR_SILENT); |