Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/csh Welcome to the 21th century csh: retire "ptr_t" now ...
details: https://anonhg.NetBSD.org/src/rev/18aee18e8a8f
branches: trunk
changeset: 447255:18aee18e8a8f
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 05 16:54:00 2019 +0000
description:
Welcome to the 21th century csh: retire "ptr_t" now that we have "void *"
diffstat:
bin/csh/alloc.c | 24 ++++++++++----------
bin/csh/csh.c | 14 +++++-----
bin/csh/csh.h | 4 +--
bin/csh/dir.c | 30 ++++++++++++------------
bin/csh/dol.c | 20 ++++++++--------
bin/csh/err.c | 6 ++--
bin/csh/exec.c | 34 ++++++++++++++--------------
bin/csh/exp.c | 34 ++++++++++++++--------------
bin/csh/extern.h | 12 +++++-----
bin/csh/file.c | 13 +++++-----
bin/csh/func.c | 37 ++++++++++++++++---------------
bin/csh/glob.c | 66 ++++++++++++++++++++++++++-----------------------------
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 | 30 ++++++++++++------------
bin/csh/set.c | 18 +++++++-------
bin/csh/str.c | 16 +++++--------
20 files changed, 209 insertions(+), 219 deletions(-)
diffs (truncated from 1530 to 300 lines):
diff -r 750da94a767c -r 18aee18e8a8f bin/csh/alloc.c
--- a/bin/csh/alloc.c Sat Jan 05 16:50:22 2019 +0000
+++ b/bin/csh/alloc.c Sat Jan 05 16:54:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: alloc.c,v 1.15 2019/01/05 16:54:00 christos 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.14 2019/01/05 10:51:06 maya Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.15 2019/01/05 16:54:00 christos Exp $");
#endif
#endif /* not lint */
@@ -47,36 +47,36 @@
#include "csh.h"
#include "extern.h"
-ptr_t
+void *
Malloc(size_t n)
{
- ptr_t ptr;
+ void *ptr;
- if ((ptr = malloc(n)) == (ptr_t) 0) {
+ if ((ptr = malloc(n)) == NULL) {
child++;
stderror(ERR_NOMEM);
}
return (ptr);
}
-ptr_t
-Realloc(ptr_t p, size_t n)
+void *
+Realloc(void *p, size_t n)
{
- ptr_t ptr;
+ void *ptr;
- if ((ptr = realloc(p, n)) == (ptr_t) 0) {
+ if ((ptr = realloc(p, n)) == NULL) {
child++;
stderror(ERR_NOMEM);
}
return (ptr);
}
-ptr_t
+void *
Calloc(size_t s, size_t n)
{
- ptr_t ptr;
+ void *ptr;
- if ((ptr = calloc(s, n)) == (ptr_t) 0) {
+ if ((ptr = calloc(s, n)) == NULL) {
child++;
stderror(ERR_NOMEM);
}
diff -r 750da94a767c -r 18aee18e8a8f bin/csh/csh.c
--- a/bin/csh/csh.c Sat Jan 05 16:50:22 2019 +0000
+++ b/bin/csh/csh.c Sat Jan 05 16:54:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos 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.47 2019/01/05 10:51:06 maya Exp $");
+__RCSID("$NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $");
#endif
#endif /* not lint */
@@ -641,7 +641,7 @@
ep = Strspl(cp, dp);
ptr = short2str(ep);
- free((ptr_t) ep);
+ free(ep);
return srcfile(ptr, mflag ? 0 : 1, 0);
}
@@ -760,8 +760,8 @@
/* This code could get run twice but free doesn't care */
/* XXX yes it does */
for (i = 0; i < fblocks; i++)
- free((ptr_t) fbuf[i]);
- free((ptr_t) fbuf);
+ free(fbuf[i]);
+ free(fbuf);
/* Reset input arena */
(void)memcpy(&B, &saveB, sizeof(B));
@@ -1062,7 +1062,7 @@
(void)fflush(cshout);
}
if (seterr) {
- free((ptr_t) seterr);
+ free(seterr);
seterr = NULL;
}
@@ -1146,7 +1146,7 @@
(void)Strcpy(buf, *v);
f = globone(buf, G_ERROR);
(void)strcpy((char *)buf, short2str(f));
- free((ptr_t) f);
+ free(f);
if (!srcfile((char *)buf, 0, hflg) && !hflg)
stderror(ERR_SYSTEM, (char *)buf, strerror(errno));
}
diff -r 750da94a767c -r 18aee18e8a8f bin/csh/csh.h
--- a/bin/csh/csh.h Sat Jan 05 16:50:22 2019 +0000
+++ b/bin/csh/csh.h Sat Jan 05 16:54:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.27 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: csh.h,v 1.28 2019/01/05 16:54:00 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -80,8 +80,6 @@
typedef void *ioctl_t; /* Third arg of ioctl */
-typedef void *ptr_t;
-
#include "const.h"
#include "char.h"
#include "errnum.h"
diff -r 750da94a767c -r 18aee18e8a8f bin/csh/dir.c
--- a/bin/csh/dir.c Sat Jan 05 16:50:22 2019 +0000
+++ b/bin/csh/dir.c Sat Jan 05 16:54:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.31 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: dir.c,v 1.32 2019/01/05 16:54:00 christos 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.31 2019/01/05 10:51:06 maya Exp $");
+__RCSID("$NetBSD: dir.c,v 1.32 2019/01/05 16:54:00 christos Exp $");
#endif
#endif /* not lint */
@@ -312,7 +312,7 @@
cwd[dotdot = Strlen(cwd)] = '/';
cwd[dotdot + 1] = '\0';
dp = Strspl(cwd, cp);
- free((ptr_t) cwd);
+ free(cwd);
return dp;
}
else {
@@ -396,7 +396,7 @@
p--; /* don't add a / after root */
for (q = cp; (*p++ = *q++) != '\0';)
continue;
- free((ptr_t) cp);
+ free(cp);
cp = dp;
dp += cwdlen;
}
@@ -424,11 +424,11 @@
*/
dp = dnormalize(cp);
if (chdir(short2str(dp)) >= 0) {
- free((ptr_t) cp);
+ free(cp);
return dgoto(dp);
}
else {
- free((ptr_t) dp);
+ free(dp);
if (chdir(short2str(cp)) >= 0)
return dgoto(cp);
serrno = errno;
@@ -448,7 +448,7 @@
continue;
if (chdir(short2str(buf)) >= 0) {
printd = 1;
- free((ptr_t) cp);
+ free(cp);
cp = Strsave(buf);
return dgoto(cp);
}
@@ -456,13 +456,13 @@
}
dp = value(cp);
if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
- free((ptr_t) cp);
+ free(cp);
cp = Strsave(dp);
printd = 1;
return dgoto(cp);
}
(void)strcpy(ebuf, short2str(cp));
- free((ptr_t) cp);
+ free(cp);
stderror(ERR_SYSTEM, ebuf, strerror(serrno));
/* NOTREACHED */
}
@@ -596,8 +596,8 @@
dp->di_next = dp->di_prev = 0;
}
else {
- free((char *) dp->di_name);
- free((ptr_t) dp);
+ free(dp->di_name);
+ free(dp);
}
}
@@ -632,7 +632,7 @@
(void)Strcpy(tmpdir, p1);
(void)Strcat(tmpdir, STRslash);
(void)Strcat(tmpdir, cp);
- free((ptr_t) cp);
+ free(cp);
cp = p = Strsave(tmpdir);
}
@@ -737,7 +737,7 @@
*/
p = newcp;
}
- free((ptr_t) cp);
+ free(cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -826,7 +826,7 @@
*/
p = newcp;
}
- free((ptr_t) cp);
+ free(cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -880,7 +880,7 @@
* Use STRhome to make '~' work
*/
newcp = Strspl(p1, cp + Strlen(p2));
- free((ptr_t) cp);
+ free(cp);
cp = newcp;
}
}
diff -r 750da94a767c -r 18aee18e8a8f bin/csh/dol.c
--- a/bin/csh/dol.c Sat Jan 05 16:50:22 2019 +0000
+++ b/bin/csh/dol.c Sat Jan 05 16:54:00 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dol.c,v 1.30 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: dol.c,v 1.31 2019/01/05 16:54:00 christos 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.30 2019/01/05 10:51:06 maya Exp $");
+__RCSID("$NetBSD: dol.c,v 1.31 2019/01/05 16:54:00 christos Exp $");
#endif
#endif /* not lint */
@@ -416,7 +416,7 @@
stderror(ERR_SYNTAX);
if (backpid != 0) {
if (dolbang)
- free((ptr_t)dolbang);
+ free(dolbang);
setDolp(dolbang = putn(backpid));
}
goto eatbrac;
@@ -595,7 +595,7 @@
Char *cp = putn(upb - lwb + 1);
addla(cp);
- free((ptr_t) cp);
+ free(cp);
}
else {
eatmod:
@@ -717,7 +717,7 @@
(void)Strcpy(np + (dp - cp), rhsub);
(void)Strcpy(np + (dp - cp) + rhlen, dp + lhlen);
Home |
Main Index |
Thread Index |
Old Index