Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/csh Remove Free, s/xfree/free/.
details: https://anonhg.NetBSD.org/src/rev/c31bbb7b53bc
branches: trunk
changeset: 447251:c31bbb7b53bc
user: maya <maya%NetBSD.org@localhost>
date: Sat Jan 05 10:51:06 2019 +0000
description:
Remove Free, s/xfree/free/.
Standard C says that free should be a no-op for a NULL pointer, so
we don't need an extra function to do this.
While here, add an XXX about a wrong sounding comment
diffstat:
bin/csh/alloc.c | 11 ++---------
bin/csh/csh.c | 17 +++++++++--------
bin/csh/csh.h | 3 +--
bin/csh/dir.c | 30 +++++++++++++++---------------
bin/csh/dol.c | 20 ++++++++++----------
bin/csh/err.c | 6 +++---
bin/csh/exec.c | 32 ++++++++++++++++----------------
bin/csh/exp.c | 34 +++++++++++++++++-----------------
bin/csh/file.c | 8 ++++----
bin/csh/func.c | 34 +++++++++++++++++-----------------
bin/csh/glob.c | 30 +++++++++++++++---------------
bin/csh/hist.c | 6 +++---
bin/csh/lex.c | 18 +++++++++---------
bin/csh/misc.c | 10 +++++-----
bin/csh/parse.c | 28 ++++++++++++++--------------
bin/csh/proc.c | 8 ++++----
bin/csh/sem.c | 28 ++++++++++++++--------------
bin/csh/set.c | 18 +++++++++---------
18 files changed, 167 insertions(+), 174 deletions(-)
diffs (truncated from 1274 to 300 lines):
diff -r 3e44cb685e83 -r c31bbb7b53bc bin/csh/alloc.c
--- a/bin/csh/alloc.c Sat Jan 05 10:25:11 2019 +0000
+++ b/bin/csh/alloc.c Sat Jan 05 10:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $ */
+/* $NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $ */
/*-
* Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $");
#endif
#endif /* not lint */
@@ -82,10 +82,3 @@
}
return (ptr);
}
-
-void
-Free(ptr_t p)
-{
- if (p)
- free(p);
-}
diff -r 3e44cb685e83 -r c31bbb7b53bc bin/csh/csh.c
--- a/bin/csh/csh.c Sat Jan 05 10:25:11 2019 +0000
+++ b/bin/csh/csh.c Sat Jan 05 10:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.46 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
#else
-__RCSID("$NetBSD: csh.c,v 1.46 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $");
#endif
#endif /* not lint */
@@ -641,7 +641,7 @@
ep = Strspl(cp, dp);
ptr = short2str(ep);
- xfree((ptr_t) ep);
+ free((ptr_t) ep);
return srcfile(ptr, mflag ? 0 : 1, 0);
}
@@ -757,10 +757,11 @@
int i;
/* We made it to the new state... free up its storage */
- /* This code could get run twice but xfree doesn't care */
+ /* This code could get run twice but free doesn't care */
+ /* XXX yes it does */
for (i = 0; i < fblocks; i++)
- xfree((ptr_t) fbuf[i]);
- xfree((ptr_t) fbuf);
+ free((ptr_t) fbuf[i]);
+ free((ptr_t) fbuf);
/* Reset input arena */
(void)memcpy(&B, &saveB, sizeof(B));
@@ -1061,7 +1062,7 @@
(void)fflush(cshout);
}
if (seterr) {
- xfree((ptr_t) seterr);
+ free((ptr_t) seterr);
seterr = NULL;
}
@@ -1145,7 +1146,7 @@
(void)Strcpy(buf, *v);
f = globone(buf, G_ERROR);
(void)strcpy((char *)buf, short2str(f));
- xfree((ptr_t) f);
+ free((ptr_t) f);
if (!srcfile((char *)buf, 0, hflg) && !hflg)
stderror(ERR_SYSTEM, (char *)buf, strerror(errno));
}
diff -r 3e44cb685e83 -r c31bbb7b53bc bin/csh/csh.h
--- a/bin/csh/csh.h Sat Jan 05 10:25:11 2019 +0000
+++ b/bin/csh/csh.h Sat Jan 05 10:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.26 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: csh.h,v 1.27 2019/01/05 10:51:06 maya Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -89,7 +89,6 @@
#define xmalloc(i) Malloc(i)
#define xrealloc(p, i) Realloc(p, i)
#define xcalloc(n, s) Calloc(n, s)
-#define xfree(p) Free(p)
#include <stdio.h>
FILE *cshin, *cshout, *csherr;
diff -r 3e44cb685e83 -r c31bbb7b53bc bin/csh/dir.c
--- a/bin/csh/dir.c Sat Jan 05 10:25:11 2019 +0000
+++ b/bin/csh/dir.c Sat Jan 05 10:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.30 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: dir.c,v 1.31 2019/01/05 10:51:06 maya Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dir.c,v 1.30 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: dir.c,v 1.31 2019/01/05 10:51:06 maya Exp $");
#endif
#endif /* not lint */
@@ -312,7 +312,7 @@
cwd[dotdot = Strlen(cwd)] = '/';
cwd[dotdot + 1] = '\0';
dp = Strspl(cwd, cp);
- xfree((ptr_t) cwd);
+ free((ptr_t) cwd);
return dp;
}
else {
@@ -396,7 +396,7 @@
p--; /* don't add a / after root */
for (q = cp; (*p++ = *q++) != '\0';)
continue;
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = dp;
dp += cwdlen;
}
@@ -424,11 +424,11 @@
*/
dp = dnormalize(cp);
if (chdir(short2str(dp)) >= 0) {
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
return dgoto(dp);
}
else {
- xfree((ptr_t) dp);
+ free((ptr_t) dp);
if (chdir(short2str(cp)) >= 0)
return dgoto(cp);
serrno = errno;
@@ -448,7 +448,7 @@
continue;
if (chdir(short2str(buf)) >= 0) {
printd = 1;
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = Strsave(buf);
return dgoto(cp);
}
@@ -456,13 +456,13 @@
}
dp = value(cp);
if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = Strsave(dp);
printd = 1;
return dgoto(cp);
}
(void)strcpy(ebuf, short2str(cp));
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
stderror(ERR_SYSTEM, ebuf, strerror(serrno));
/* NOTREACHED */
}
@@ -596,8 +596,8 @@
dp->di_next = dp->di_prev = 0;
}
else {
- xfree((char *) dp->di_name);
- xfree((ptr_t) dp);
+ free((char *) dp->di_name);
+ free((ptr_t) dp);
}
}
@@ -632,7 +632,7 @@
(void)Strcpy(tmpdir, p1);
(void)Strcat(tmpdir, STRslash);
(void)Strcat(tmpdir, cp);
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = p = Strsave(tmpdir);
}
@@ -737,7 +737,7 @@
*/
p = newcp;
}
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -826,7 +826,7 @@
*/
p = newcp;
}
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -880,7 +880,7 @@
* Use STRhome to make '~' work
*/
newcp = Strspl(p1, cp + Strlen(p2));
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = newcp;
}
}
diff -r 3e44cb685e83 -r c31bbb7b53bc bin/csh/dol.c
--- a/bin/csh/dol.c Sat Jan 05 10:25:11 2019 +0000
+++ b/bin/csh/dol.c Sat Jan 05 10:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dol.c,v 1.29 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: dol.c,v 1.30 2019/01/05 10:51:06 maya Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dol.c,v 1.29 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: dol.c,v 1.30 2019/01/05 10:51:06 maya Exp $");
#endif
#endif /* not lint */
@@ -416,7 +416,7 @@
stderror(ERR_SYNTAX);
if (backpid != 0) {
if (dolbang)
- xfree((ptr_t)dolbang);
+ free((ptr_t)dolbang);
setDolp(dolbang = putn(backpid));
}
goto eatbrac;
@@ -595,7 +595,7 @@
Char *cp = putn(upb - lwb + 1);
addla(cp);
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
}
else {
eatmod:
@@ -717,7 +717,7 @@
(void)Strcpy(np + (dp - cp), rhsub);
(void)Strcpy(np + (dp - cp) + rhlen, dp + lhlen);
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
dp = cp = np;
didmod = 1;
} else {
@@ -741,12 +741,12 @@
if ((dp = domod(cp, dolmod[i]))) {
didmod = 1;
if (Strcmp(cp, dp) == 0) {
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = dp;
break;
}
else {
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
cp = dp;
}
}
@@ -764,11 +764,11 @@
if (dp) {
addla(dp);
- xfree((ptr_t) dp);
+ free((ptr_t) dp);
}
else {
addla(cp);
- xfree((ptr_t) cp);
+ free((ptr_t) cp);
}
Home |
Main Index |
Thread Index |
Old Index