Hello Michael!
Sorry, mea culpa. I hope it's not mangled now:
Index: alloc.c
===================================================================
RCS file: /cvs/src/bin/csh/alloc.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 alloc.c
--- alloc.c 8 Feb 2015 06:01:25 -0000 1.16
+++ alloc.c 12 Nov 2015 20:07:44 -0000
@@ -74,9 +74,3 @@ Calloc(size_t s, size_t n)
return (ptr);
}
-
-void
-Free(void *p)
-{
- free(p);
-}
Index: csh.c
===================================================================
RCS file: /cvs/src/bin/csh/csh.c,v
retrieving revision 1.36
diff -u -p -u -r1.36 csh.c
--- csh.c 11 Nov 2015 02:52:46 -0000 1.36
+++ csh.c 12 Nov 2015 20:07:52 -0000
@@ -609,7 +609,7 @@ srccat(Char *cp, Char *dp)
Char *ep = Strspl(cp, dp);
char *ptr = short2str(ep);
- xfree(ep);
+ free(ep);
return srcfile(ptr, mflag ? 0 : 1, 0);
}
@@ -716,10 +716,10 @@ srcunit(int unit, bool onlyown, bool hfl
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 */
for (i = 0; i < fblocks; i++)
- xfree(fbuf[i]);
- xfree(fbuf);
+ free(fbuf[i]);
+ free(fbuf);
/* Reset input arena */
memcpy(&B, &saveB, sizeof(B));
@@ -1014,7 +1014,7 @@ process(bool catch)
(void) fflush(cshout);
}
if (seterr) {
- xfree(seterr);
+ free(seterr);
seterr = NULL;
}
@@ -1094,7 +1094,7 @@ dosource(Char **v, struct command *t)
(void) Strlcpy(buf, *v, sizeof buf/sizeof(Char));
f = globone(buf, G_ERROR);
(void) strlcpy(sbuf, short2str(f), sizeof sbuf);
- xfree(f);
+ free(f);
if (!srcfile(sbuf, 0, hflg) && !hflg)
stderror(ERR_SYSTEM, sbuf, strerror(errno));
}
Index: csh.h
===================================================================
RCS file: /cvs/src/bin/csh/csh.h,v
retrieving revision 1.27
diff -u -p -u -r1.27 csh.h
--- csh.h 28 Oct 2015 22:18:53 -0000 1.27
+++ csh.h 12 Nov 2015 20:07:54 -0000
@@ -72,7 +72,6 @@ typedef void *ioctl_t; /* Third arg of
#define xmalloc(i) Malloc(i)
#define xreallocarray(p, i, j) Reallocarray(p, i, j)
#define xcalloc(n, s) Calloc(n, s)
-#define xfree(p) Free(p)
#include <stdio.h>
FILE *cshin, *cshout, *csherr;
Index: dir.c
===================================================================
RCS file: /cvs/src/bin/csh/dir.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 dir.c
--- dir.c 8 Feb 2015 06:09:50 -0000 1.20
+++ dir.c 12 Nov 2015 20:07:56 -0000
@@ -299,7 +299,7 @@ dnormalize(Char *cp)
cwd[dotdot = Strlen(cwd)] = '/';
cwd[dotdot + 1] = '\0';
dp = Strspl(cwd, cp);
- xfree(cwd);
+ free(cwd);
return dp;
}
else {
@@ -386,7 +386,7 @@ dgoto(Char *cp)
p--; /* don't add a / after root */
for (q = cp; (*p++ = *q++) != '\0';)
continue;
- xfree(cp);
+ free(cp);
cp = dp;
dp += cwdlen;
}
@@ -414,11 +414,11 @@ dfollow(Char *cp)
*/
dp = dnormalize(cp);
if (chdir(short2str(dp)) >= 0) {
- xfree(cp);
+ free(cp);
return dgoto(dp);
}
else {
- xfree(dp);
+ free(dp);
if (chdir(short2str(cp)) >= 0)
return dgoto(cp);
serrno = errno;
@@ -438,7 +438,7 @@ dfollow(Char *cp)
continue;
if (chdir(short2str(buf)) >= 0) {
printd = 1;
- xfree(cp);
+ free(cp);
cp = Strsave(buf);
return dgoto(cp);
}
@@ -446,13 +446,13 @@ dfollow(Char *cp)
}
dp = value(cp);
if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
- xfree(cp);
+ free(cp);
cp = Strsave(dp);
printd = 1;
return dgoto(cp);
}
(void) strlcpy(ebuf, short2str(cp), sizeof ebuf);
- xfree(cp);
+ free(cp);
stderror(ERR_SYSTEM, ebuf, strerror(serrno));
return (NULL);
}
@@ -593,8 +593,8 @@ dfree(struct directory *dp)
dp->di_next = dp->di_prev = 0;
}
else {
- xfree((char *) dp->di_name);
- xfree(dp);
+ free((char *) dp->di_name);
+ free(dp);
}
}
@@ -630,7 +630,7 @@ dcanon(Char *cp, Char *p)
(void) Strlcpy(tmpdir, p1, sizeof tmpdir/sizeof(Char));
(void) Strlcat(tmpdir, STRslash, sizeof tmpdir/sizeof(Char));
(void) Strlcat(tmpdir, cp, sizeof tmpdir/sizeof(Char));
- xfree(cp);
+ free(cp);
cp = p = Strsave(tmpdir);
}
@@ -735,7 +735,7 @@ dcanon(Char *cp, Char *p)
*/
p = newcp;
}
- xfree(cp);
+ free(cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -824,7 +824,7 @@ dcanon(Char *cp, Char *p)
*/
p = newcp;
}
- xfree(cp);
+ free(cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -879,7 +879,7 @@ dcanon(Char *cp, Char *p)
* Use STRhome to make '~' work
*/
newcp = Strspl(p1, cp + Strlen(p2));
- xfree(cp);
+ free(cp);
cp = newcp;
}
}
Index: dol.c
===================================================================
RCS file: /cvs/src/bin/csh/dol.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 dol.c
--- dol.c 8 Feb 2015 05:51:37 -0000 1.19
+++ dol.c 12 Nov 2015 20:08:00 -0000
@@ -409,7 +409,7 @@ Dgetdol(void)
stderror(ERR_SYNTAX);
if (backpid != 0) {
if (dolbang)
- xfree(dolbang);
+ free(dolbang);
setDolp(dolbang = putn(backpid));
}
goto eatbrac;
@@ -595,7 +595,7 @@ Dgetdol(void)
Char *cp = putn(upb - lwb + 1);
addla(cp);
- xfree(cp);
+ free(cp);
}
else {
eatmod:
@@ -718,7 +718,7 @@ setDolp(Char *cp)
(void) Strlcat(np, rhsub, len);
(void) Strlcat(np, dp + lhlen, len);
- xfree(cp);
+ free(cp);
dp = cp = np;
didmod = 1;
} else {
@@ -742,12 +742,12 @@ setDolp(Char *cp)
if ((dp = domod(cp, dolmod[i]))) {
didmod = 1;
if (Strcmp(cp, dp) == 0) {
- xfree(cp);
+ free(cp);
cp = dp;
break;
}
else {
- xfree(cp);
+ free(cp);
cp = dp;
}
}
@@ -765,7 +765,7 @@ setDolp(Char *cp)
if (dp) {
addla(dp);
- xfree(dp);
+ free(dp);
}
else
addla(cp);
Index: error.c
===================================================================
RCS file: /cvs/src/bin/csh/error.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 error.c
--- error.c 8 Feb 2015 05:51:37 -0000 1.11
+++ error.c 12 Nov 2015 20:08:03 -0000
@@ -347,7 +347,7 @@ stderror(int id, ...)
}
if (seterr) {
- xfree(seterr);
+ free(seterr);
seterr = NULL;
}
Index: exec.c
===================================================================
RCS file: /cvs/src/bin/csh/exec.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 exec.c
--- exec.c 28 Oct 2015 22:18:53 -0000 1.18
+++ exec.c 12 Nov 2015 20:08:05 -0000
@@ -159,8 +159,8 @@ doexec(Char **v, struct command *t)
blkfree(t->t_dcom);
t->t_dcom = blkspl(pv, av);
- xfree(pv);
- xfree(av);
+ free(pv);
+ free(av);
av = t->t_dcom;
trim(av);
@@ -216,7 +216,7 @@ doexec(Char **v, struct command *t)
Vdp = dp;
texec(dp, av);
Vdp = 0;
- xfree(dp);
+ free(dp);
}
misses++;
cont:
@@ -225,7 +225,7 @@ cont:
} while (*pv);
hits--;
Vsav = 0;
- xfree(sav);
+ free(sav);
pexerr();
}
@@ -236,7 +236,7 @@ pexerr(void)
if (expath) {
setname(vis_str(expath));
Vexpath = 0;
- xfree(expath);
+ free(expath);
expath = 0;
}
else
@@ -316,7 +316,7 @@ texec(Char *sf, Char **st)
/* The order for the conversions is significant */
t = short2blk(st);
f = short2str(sf);
- xfree(st);
+ free(st);
Vt = t;
(void) execve(f, t, environ);
Vt = 0;
@@ -333,7 +333,7 @@ texec(Char *sf, Char **st)
if (exerr == 0) {
exerr = strerror(errno);
if (expath)
- xfree(expath);
+ free(expath);
expath = Strsave(sf);
Vexpath = expath;
}
@@ -512,13 +512,13 @@ iscommand(Char *name)
}
if (pv[0][0] == 0 || eq(pv[0], STRdot)) { /* don't make ./xxx */
if (executable(NULL, name, 0)) {
- xfree(sav);
+ free(sav);
return i + 1;
}
}
else {
if (executable(*pv, sav, 0)) {
- xfree(sav);
+ free(sav);
return i + 1;
}
}
@@ -526,7 +526,7 @@ cont:
pv++;
i++;
} while (*pv);
- xfree(sav);
+ free(sav);
return 0;
}
@@ -694,7 +694,7 @@ tellmewhat(struct wordent *lexp, Char *s
if (!slash) {
sp->word = Strspl(STRdotsl, sp->word);
prlex(cshout, lexp);
- xfree(sp->word);
+ free(sp->word);
}
else
prlex(cshout, lexp);
@@ -702,12 +702,12 @@ tellmewhat(struct wordent *lexp, Char *s
else {
s1 = Strspl(*pv, STRslash);
sp->word = Strspl(s1, sp->word);
- xfree(s1);
+ free(s1);
if (str == NULL)
prlex(cshout, lexp);
else
(void) Strlcpy(str, sp->word, len/sizeof(Char));
- xfree(sp->word);
+ free(sp->word);
}
found = 1;
}
@@ -723,6 +723,6 @@ tellmewhat(struct wordent *lexp, Char *s
found = 0;
}
sp->word = s0; /* we save and then restore this */
- xfree(cmd);
+ free(cmd);
return found;
}
Index: exp.c
===================================================================
RCS file: /cvs/src/bin/csh/exp.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 exp.c
--- exp.c 26 Oct 2015 22:03:06 -0000 1.15
+++ exp.c 12 Nov 2015 20:08:06 -0000
@@ -183,12 +183,12 @@ exp2c(Char ***vp, bool ignore)
i = !Gmatch(p1, p2);
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (i);
}
i = egetn(p1);
- xfree(p1);
+ free(p1);
return (i);
}
@@ -223,8 +223,8 @@ exp3(Char ***vp, bool ignore)
i = egetn(p1) <= egetn(p2);
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -245,8 +245,8 @@ exp3a(Char ***vp, bool ignore)
i = egetn(p1) << egetn(p2);
else
i = egetn(p1) >> egetn(p2);
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -274,8 +274,8 @@ exp4(Char ***vp, bool ignore)
i = egetn(p1) - egetn(p2);
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -321,8 +321,8 @@ exp5(Char ***vp, bool ignore)
i = l % i;
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -340,14 +340,14 @@ exp6(Char ***vp, bool ignore)
(*vp)++;
cp = exp6(vp, ignore);
i = egetn(cp);
- xfree(cp);
+ free(cp);
return (putn(!i));
}
if (eq(**vp, STRtilde)) {
(*vp)++;
cp = exp6(vp, ignore);
i = egetn(cp);
- xfree(cp);
+ free(cp);
return (putn(~i));
}
if (eq(**vp, STRLparen)) {
@@ -428,7 +428,7 @@ exp6(Char ***vp, bool ignore)
default:
if (cp[1] == 'l' ? lstat(short2str(ep), &stb) :
stat(short2str(ep), &stb)) {
- xfree(ep);
+ free(ep);
return (Strsave(STR0));
}
switch (cp[1]) {
@@ -466,7 +466,7 @@ exp6(Char ***vp, bool ignore)
break;
}
}
- xfree(ep);
+ free(ep);
return (putn(i));
}
return (ignore & NOGLOB ? Strsave(cp) : globone(cp, G_ERROR));
Index: extern.h
===================================================================
RCS file: /cvs/src/bin/csh/extern.h,v
retrieving revision 1.24
diff -u -p -u -r1.24 extern.h
--- extern.h 26 Oct 2015 21:57:42 -0000 1.24
+++ extern.h 12 Nov 2015 20:08:08 -0000
@@ -281,7 +281,6 @@ void psecs(long);
/*
* alloc.c
*/
-void Free(void *);
void * Malloc(size_t);
void * Reallocarray(void *, size_t, size_t);
void * Calloc(size_t, size_t);
Index: file.c
===================================================================
RCS file: /cvs/src/bin/csh/file.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 file.c
--- file.c 26 Oct 2015 15:01:15 -0000 1.22
+++ file.c 12 Nov 2015 20:08:09 -0000
@@ -390,8 +390,8 @@ free_items(Char **items, int numitems)
int i;
for (i = 0; i < numitems; i++)
- xfree(items[i]);
- xfree(items);
+ free(items[i]);
+ free(items);
}
#define FREE_ITEMS(items) { \
Index: func.c
===================================================================
RCS file: /cvs/src/bin/csh/func.c,v
retrieving revision 1.31
diff -u -p -u -r1.31 func.c
--- func.c 26 Oct 2015 16:27:04 -0000 1.31
+++ func.c 12 Nov 2015 20:08:11 -0000
@@ -127,7 +127,7 @@ doonintr(Char **v, struct command *t)
stderror(ERR_NAME | ERR_TERMINAL);
cp = gointr;
gointr = 0;
- xfree(cp);
+ free(cp);
if (vv == 0) {
if (setintr) {
sigemptyset(&sigset);
@@ -300,7 +300,7 @@ dogoto(Char **v, struct command *t)
Char *lp;
gotolab(lp = globone(v[1], G_ERROR));
- xfree(lp);
+ free(lp);
}
void
@@ -341,7 +341,7 @@ doswitch(Char **v, struct command *t)
if (*v)
stderror(ERR_SYNTAX);
search(T_SWITCH, 0, lp = globone(cp, G_ERROR));
- xfree(lp);
+ free(lp);
}
void
@@ -659,7 +659,7 @@ search(int type, int level, Char *goal)
cp = strip(Dfix1(aword));
if (Gmatch(goal, cp))
level = -1;
- xfree(cp);
+ free(cp);
break;
case T_DEFAULT:
@@ -824,8 +824,8 @@ wfree(void)
if (wp->w_fe0)
blkfree(wp->w_fe0);
if (wp->w_fename)
- xfree(wp->w_fename);
- xfree(wp);
+ free(wp->w_fename);
+ free(wp);
}
}
@@ -917,7 +917,7 @@ dosetenv(Char **v, struct command *t)
importpath(lp);
dohash(NULL, NULL);
}
- xfree(lp);
+ free(lp);
}
void
@@ -929,7 +929,7 @@ dounsetenv(Char **v, struct command *t)
static Char *name = NULL;
if (name)
- xfree(name);
+ free(name);
/*
* Find the longest environment variable
*/
@@ -957,7 +957,7 @@ dounsetenv(Char **v, struct command *t)
Unsetenv(name);
break;
}
- xfree(name);
+ free(name);
name = NULL;
}
@@ -975,21 +975,21 @@ Setenv(Char *name, Char *val)
if (*cp != 0 || *dp != '=')
continue;
cp = Strspl(STRequal, val);
- xfree(* ep);
+ free(* ep);
*ep = strip(Strspl(name, cp));
- xfree(cp);
+ free(cp);
blkfree((Char **) environ);
environ = short2blk(STR_environ);
return;
}
cp = Strspl(name, STRequal);
blk[0] = strip(Strspl(cp, val));
- xfree(cp);
+ free(cp);
blk[1] = 0;
STR_environ = blkspl(STR_environ, blk);
blkfree((Char **) environ);
environ = short2blk(STR_environ);
- xfree(oep);
+ free(oep);
}
static void
@@ -1009,8 +1009,8 @@ Unsetenv(Char *name)
STR_environ = blkspl(STR_environ, ep + 1);
environ = short2blk(STR_environ);
*ep = cp;
- xfree(cp);
- xfree(oep);
+ free(cp);
+ free(oep);
return;
}
}
Index: glob.c
===================================================================
RCS file: /cvs/src/bin/csh/glob.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 glob.c
--- glob.c 26 Oct 2015 22:03:06 -0000 1.20
+++ glob.c 12 Nov 2015 20:08:13 -0000
@@ -110,7 +110,7 @@ globtilde(Char **nv, Char *s)
*b++ = *s++;
*b = EOS;
--u;
- xfree(u);
+ free(u);
return (Strsave(gstart));
}
@@ -228,13 +228,13 @@ expbrace(Char ***nvp, Char ***elp, int s
int len;
if ((len = globbrace(s, b, &bl)) < 0) {
- xfree(nv);
+ free(nv);
stderror(ERR_MISSING, -len);
}
- xfree(s);
+ free(s);
if (len == 1) {
*vl-- = *bl;
- xfree(bl);
+ free(bl);
continue;
}
len = blklen(bl);
@@ -258,7 +258,7 @@ expbrace(Char ***nvp, Char ***elp, int s
vp++;
for (bp = bl + 1; *bp; *vp++ = *bp++)
continue;
- xfree(bl);
+ free(bl);
}
}
@@ -294,7 +294,7 @@ globexpand(Char **v)
vl = &nv[size - GLOBSPACE];
}
}
- xfree(pargv);
+ free(pargv);
pargv = NULL;
}
else {
@@ -345,9 +345,9 @@ handleone(Char *str, Char **vl, int acti
str = Strsave(*vlp++);
do {
cp = Strspl(str, STRspace);
- xfree(str);
+ free(str);
str = Strspl(cp, *vlp);
- xfree(cp);
+ free(cp);
}
while (*++vlp)
;
@@ -430,14 +430,14 @@ globone(Char *str, int action)
vo = globexpand(v);
if (noglob || (gflg & G_GLOB) == 0) {
if (vo[0] == NULL) {
- xfree(vo);
+ free(vo);
return (Strsave(STRNULL));
}
if (vo[1] != NULL)
return (handleone(str, vo, action));
else {
str = strip(vo[0]);
- xfree(vo);
+ free(vo);
return (str);
}
}
@@ -455,14 +455,14 @@ globone(Char *str, int action)
stderror(ERR_NAME | ERR_NOMATCH);
}
if (vl[0] == NULL) {
- xfree(vl);
+ free(vl);
return (Strsave(STRNULL));
}
if (vl[1] != NULL)
return (handleone(str, vl, action));
else {
str = strip(*vl);
- xfree(vl);
+ free(vl);
return (str);
}
}
@@ -692,7 +692,7 @@ backeval(Char *cp, bool literal)
execute(t, -1, NULL, NULL);
exitstat();
}
- xfree(cp);
+ free(cp);
(void) close(pvec[1]);
c = 0;
ip = NULL;
Index: hist.c
===================================================================
RCS file: /cvs/src/bin/csh/hist.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 hist.c
--- hist.c 8 Feb 2015 05:51:37 -0000 1.9
+++ hist.c 12 Nov 2015 20:08:15 -0000
@@ -97,7 +97,7 @@ hfree(struct Hist *hp)
{
freelex(&hp->Hlex);
- xfree(hp);
+ free(hp);
}
void
Index: lex.c
===================================================================
RCS file: /cvs/src/bin/csh/lex.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 lex.c
--- lex.c 26 Oct 2015 22:03:06 -0000 1.20
+++ lex.c 12 Nov 2015 20:08:18 -0000
@@ -211,8 +211,8 @@ freelex(struct wordent *vp)
while (vp->next != vp) {
fp = vp->next;
vp->next = fp->next;
- xfree(fp->word);
- xfree(fp);
+ free(fp->word);
+ free(fp);
}
vp->prev = vp;
}
@@ -847,11 +847,11 @@ dosub(int sc, struct wordent *en, bool g
otword = tword;
tword = subword(otword, sc, &didone);
if (Strcmp(tword, otword) == 0) {
- xfree(otword);
+ free(otword);
break;
}
else
- xfree(otword);
+ free(otword);
}
}
}
@@ -1413,7 +1413,7 @@ again:
if (fbuf) {
(void) blkcpy(nfbuf, fbuf);
- xfree(fbuf);
+ free(fbuf);
}
fbuf = nfbuf;
fbuf[fblocks] = xcalloc(BUFSIZ, sizeof(Char));
@@ -1483,7 +1483,7 @@ bfree(void)
sb = (int) (fseekp - 1) / BUFSIZ;
if (sb > 0) {
for (i = 0; i < sb; i++)
- xfree(fbuf[i]);
+ free(fbuf[i]);
(void) blkcpy(fbuf, &fbuf[sb]);
fseekp -= BUFSIZ * sb;
feobp -= BUFSIZ * sb;
Index: misc.c
===================================================================
RCS file: /cvs/src/bin/csh/misc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 misc.c
--- misc.c 26 Oct 2015 22:03:06 -0000 1.17
+++ misc.c 12 Nov 2015 20:08:19 -0000
@@ -124,8 +124,8 @@ blkfree(Char **av0)
if (!av0)
return;
for (; *av; av++)
- xfree(* av);
- xfree(av0);
+ free(* av);
+ free(av0);
}
Char **
@@ -252,7 +252,7 @@ lshift(Char **v, int c)
Char **u;
for (u = v; *u && --c >= 0; u++)
- xfree(*u);
+ free(*u);
(void) blkcpy(v, u);
}
Index: parse.c
===================================================================
RCS file: /cvs/src/bin/csh/parse.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 parse.c
--- parse.c 8 Feb 2015 06:09:50 -0000 1.11
+++ parse.c 12 Nov 2015 20:08:21 -0000
@@ -170,7 +170,7 @@ asyn3(struct wordent *p1, struct wordent
Char *cp = alout.next->word;
alout.next->word = Strspl(STRQNULL, cp);
- xfree(cp);
+ free(cp);
}
p1 = freenod(p1, redid ? p2 : p1->next);
if (alout.next != &alout) {
@@ -178,8 +178,8 @@ asyn3(struct wordent *p1, struct wordent
alout.prev->prev->next = p1->next;
alout.next->prev = p1;
p1->next = alout.next;
- xfree(alout.prev->word);
- xfree((alout.prev));
+ free(alout.prev->word);
+ free((alout.prev));
}
reset(); /* throw! */
}
@@ -190,9 +190,9 @@ freenod(struct wordent *p1, struct worde
struct wordent *retp = p1->prev;
while (p1 != p2) {
- xfree(p1->word);
+ free(p1->word);
p1 = p1->next;
- xfree((p1->prev));
+ free((p1->prev));
}
retp->next = p2;
p2->prev = retp;
@@ -645,15 +645,15 @@ freesyn(struct command *t)
case NODE_COMMAND:
for (v = t->t_dcom; *v; v++)
- xfree(* v);
- xfree((t->t_dcom));
- xfree(t->t_dlef);
- xfree(t->t_drit);
+ free(* v);
+ free((t->t_dcom));
+ free(t->t_dlef);
+ free(t->t_drit);
break;
case NODE_PAREN:
freesyn(t->t_dspr);
- xfree(t->t_dlef);
- xfree(t->t_drit);
+ free(t->t_dlef);
+ free(t->t_drit);
break;
case NODE_AND:
@@ -663,5 +663,5 @@ freesyn(struct command *t)
freesyn(t->t_dcar), freesyn(t->t_dcdr);
break;
}
- xfree(t);
+ free(t);
}
Index: proc.c
===================================================================
RCS file: /cvs/src/bin/csh/proc.c,v
retrieving revision 1.29
diff -u -p -u -r1.29 proc.c
--- proc.c 26 Oct 2015 22:03:06 -0000 1.29
+++ proc.c 12 Nov 2015 20:08:24 -0000
@@ -227,11 +227,11 @@ pwait(void)
for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp =
pp)->p_next)
if (pp->p_pid == 0) {
fp->p_next = pp->p_next;
- xfree(pp->p_command);
+ free(pp->p_command);
if (pp->p_cwd && --pp->p_cwd->di_count == 0)
if (pp->p_cwd->di_next == 0)
dfree(pp->p_cwd);
- xfree(pp);
+ free(pp);
pp = fp;
}
sigprocmask(SIG_SETMASK, &osigset, NULL);
Index: sem.c
===================================================================
RCS file: /cvs/src/bin/csh/sem.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 sem.c
--- sem.c 26 Oct 2015 22:03:06 -0000 1.20
+++ sem.c 12 Nov 2015 20:08:27 -0000
@@ -273,11 +273,11 @@ execute(struct command *t, int wanttty,
csigset = ocsigset;
nosigchld = onosigchld;
- xfree(Vsav);
+ free(Vsav);
Vsav = NULL;
- xfree(Vdp);
+ free(Vdp);
Vdp = NULL;
- xfree(Vexpath);
+ free(Vexpath);
Vexpath = NULL;
blkfree((Char **) Vt);
Vt = NULL;
@@ -483,23 +483,23 @@ splicepipe(struct command *t, Char *cp)
pv = globall(blk);
if (pv == NULL) {
setname(vis_str(blk[0]));
- xfree(blk[0]);
+ free(blk[0]);
stderror(ERR_NAME | ERR_NOMATCH);
}
gargv = NULL;
if (pv[1] != NULL) { /* we need to fix the command vector */
Char **av = blkspl(t->t_dcom, &pv[1]);
- xfree(t->t_dcom);
+ free(t->t_dcom);
t->t_dcom = av;
}
- xfree(blk[0]);
+ free(blk[0]);
blk[0] = pv[0];
- xfree(pv);
+ free(pv);
}
}
else {
blk[0] = globone(blk[1] = Dfix1(cp), G_ERROR);
- xfree(blk[1]);
+ free(blk[1]);
}
return(blk[0]);
}
@@ -529,7 +529,7 @@ doio(struct command *t, int *pipein, int
(void) dcopy(SHERR, 2);
cp = splicepipe(t, t->t_dlef);
strlcpy(tmp, short2str(cp), sizeof tmp);
- xfree(cp);
+ free(cp);
if ((fd = open(tmp, O_RDONLY)) < 0)
stderror(ERR_SYSTEM, tmp, strerror(errno));
(void) dmove(fd, 0);
@@ -555,7 +555,7 @@ doio(struct command *t, int *pipein, int
cp = splicepipe(t, t->t_drit);
strlcpy(tmp, short2str(cp), sizeof tmp);
- xfree(cp);
+ free(cp);
/*
* so > /dev/std{out,err} work
*/
Index: set.c
===================================================================
RCS file: /cvs/src/bin/csh/set.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 set.c
--- set.c 26 Oct 2015 22:03:06 -0000 1.18
+++ set.c 12 Nov 2015 20:08:28 -0000
@@ -156,7 +156,7 @@ doset(Char **v, struct command *t)
Setenv(STRHOME, cp);
/* fix directory stack for new tilde home */
dtilde();
- xfree(cp);
+ free(cp);
}
else if (eq(vp, STRfilec))
filec = 1;
@@ -181,7 +181,7 @@ asx(Char *vp, int subscr, Char *p)
{
struct varent *v = getvx(vp, subscr);
- xfree(v->vec[subscr - 1]);
+ free(v->vec[subscr - 1]);
v->vec[subscr - 1] = globone(p, G_APPEND);
}
@@ -276,9 +276,9 @@ dolet(Char **v, struct command *t)
exportpath(adrof(STRpath)->vec);
dohash(NULL, NULL);
}
- xfree(vp);
+ free(vp);
if (c != '=')
- xfree(p);
+ free(p);
} while ((p = *v++) != NULL);
}
@@ -290,7 +290,7 @@ xset(Char *cp, Char ***vp)
if (*cp) {
dp = Strsave(cp);
--(*vp);
- xfree(** vp);
+ free(** vp);
**vp = dp;
}
return (putn(expr(vp)));
@@ -505,7 +505,7 @@ unsetv1(struct varent *p)
* Free associated memory first to avoid complications.
*/
blkfree(p->vec);
- xfree(p->v_name);
+ free(p->v_name);
/*
* If p is missing one child, then we can move the other into
where p is.
* Otherwise, we find the predecessor of p, which is guaranteed to
have no
@@ -533,7 +533,7 @@ unsetv1(struct varent *p)
/*
* Free the deleted node, and rebalance.
*/
- xfree(p);
+ free(p);
balance(pp, f, 1);
}
On 12/11/2015 18:11, Michael McConville wrote:
Ricardo Mestre wrote:
Hi,
On csh(1), since Free() just calls free() and xfree() is a #define to
Free() then free() can be called directly instead of xfree() and the
#define can be removed, is this approach correct?
Seems like this patch is mangled, unless it's something on my machine.
This change looks good to me, though.
Index: alloc.c
===================================================================
RCS file: /cvs/src/bin/csh/alloc.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 alloc.c
--- alloc.c 8 Feb 2015 06:01:25 -0000 1.16
+++ alloc.c 12 Nov 2015 14:19:24 -0000
@@ -74,9 +74,3 @@ Calloc(size_t s, size_t n)
return (ptr);
}
-
-void
-Free(void *p)
-{
- free(p);
-}
Index: csh.c
===================================================================
RCS file: /cvs/src/bin/csh/csh.c,v
retrieving revision 1.36
diff -u -p -u -r1.36 csh.c
--- csh.c 11 Nov 2015 02:52:46 -0000 1.36
+++ csh.c 12 Nov 2015 14:19:31 -0000
@@ -609,7 +609,7 @@ srccat(Char *cp, Char *dp)
Char *ep = Strspl(cp, dp);
char *ptr = short2str(ep);
- xfree(ep);
+ free(ep);
return srcfile(ptr, mflag ? 0 : 1, 0);
}
@@ -716,10 +716,10 @@ srcunit(int unit, bool onlyown, bool hfl
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 */
for (i = 0; i < fblocks; i++)
- xfree(fbuf[i]);
- xfree(fbuf);
+ free(fbuf[i]);
+ free(fbuf);
/* Reset input arena */
memcpy(&B, &saveB, sizeof(B));
@@ -1014,7 +1014,7 @@ process(bool catch)
(void) fflush(cshout);
}
if (seterr) {
- xfree(seterr);
+ free(seterr);
seterr = NULL;
}
@@ -1094,7 +1094,7 @@ dosource(Char **v, struct command *t)
(void) Strlcpy(buf, *v, sizeof buf/sizeof(Char));
f = globone(buf, G_ERROR);
(void) strlcpy(sbuf, short2str(f), sizeof sbuf);
- xfree(f);
+ free(f);
if (!srcfile(sbuf, 0, hflg) && !hflg)
stderror(ERR_SYSTEM, sbuf, strerror(errno));
}
Index: csh.h
===================================================================
RCS file: /cvs/src/bin/csh/csh.h,v
retrieving revision 1.27
diff -u -p -u -r1.27 csh.h
--- csh.h 28 Oct 2015 22:18:53 -0000 1.27
+++ csh.h 12 Nov 2015 14:19:32 -0000
@@ -72,7 +72,6 @@ typedef void *ioctl_t; /* Third arg of
#define xmalloc(i) Malloc(i)
#define xreallocarray(p, i, j) Reallocarray(p, i, j)
#define xcalloc(n, s) Calloc(n, s)
-#define xfree(p) Free(p)
#include <stdio.h>
FILE *cshin, *cshout, *csherr;
Index: dir.c
===================================================================
RCS file: /cvs/src/bin/csh/dir.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 dir.c
--- dir.c 8 Feb 2015 06:09:50 -0000 1.20
+++ dir.c 12 Nov 2015 14:19:34 -0000
@@ -299,7 +299,7 @@ dnormalize(Char *cp)
cwd[dotdot = Strlen(cwd)] = '/';
cwd[dotdot + 1] = '\0';
dp = Strspl(cwd, cp);
- xfree(cwd);
+ free(cwd);
return dp;
}
else {
@@ -386,7 +386,7 @@ dgoto(Char *cp)
p--; /* don't add a / after root */
for (q = cp; (*p++ = *q++) != '\0';)
continue;
- xfree(cp);
+ free(cp);
cp = dp;
dp += cwdlen;
}
@@ -414,11 +414,11 @@ dfollow(Char *cp)
*/
dp = dnormalize(cp);
if (chdir(short2str(dp)) >= 0) {
- xfree(cp);
+ free(cp);
return dgoto(dp);
}
else {
- xfree(dp);
+ free(dp);
if (chdir(short2str(cp)) >= 0)
return dgoto(cp);
serrno = errno;
@@ -438,7 +438,7 @@ dfollow(Char *cp)
continue;
if (chdir(short2str(buf)) >= 0) {
printd = 1;
- xfree(cp);
+ free(cp);
cp = Strsave(buf);
return dgoto(cp);
}
@@ -446,13 +446,13 @@ dfollow(Char *cp)
}
dp = value(cp);
if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
- xfree(cp);
+ free(cp);
cp = Strsave(dp);
printd = 1;
return dgoto(cp);
}
(void) strlcpy(ebuf, short2str(cp), sizeof ebuf);
- xfree(cp);
+ free(cp);
stderror(ERR_SYSTEM, ebuf, strerror(serrno));
return (NULL);
}
@@ -593,8 +593,8 @@ dfree(struct directory *dp)
dp->di_next = dp->di_prev = 0;
}
else {
- xfree((char *) dp->di_name);
- xfree(dp);
+ free((char *) dp->di_name);
+ free(dp);
}
}
@@ -630,7 +630,7 @@ dcanon(Char *cp, Char *p)
(void) Strlcpy(tmpdir, p1, sizeof tmpdir/sizeof(Char));
(void) Strlcat(tmpdir, STRslash, sizeof tmpdir/sizeof(Char));
(void) Strlcat(tmpdir, cp, sizeof tmpdir/sizeof(Char));
- xfree(cp);
+ free(cp);
cp = p = Strsave(tmpdir);
}
@@ -735,7 +735,7 @@ dcanon(Char *cp, Char *p)
*/
p = newcp;
}
- xfree(cp);
+ free(cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -824,7 +824,7 @@ dcanon(Char *cp, Char *p)
*/
p = newcp;
}
- xfree(cp);
+ free(cp);
cp = newcp;
continue; /* canonicalize the link */
}
@@ -879,7 +879,7 @@ dcanon(Char *cp, Char *p)
* Use STRhome to make '~' work
*/
newcp = Strspl(p1, cp + Strlen(p2));
- xfree(cp);
+ free(cp);
cp = newcp;
}
}
Index: dol.c
===================================================================
RCS file: /cvs/src/bin/csh/dol.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 dol.c
--- dol.c 8 Feb 2015 05:51:37 -0000 1.19
+++ dol.c 12 Nov 2015 14:19:37 -0000
@@ -409,7 +409,7 @@ Dgetdol(void)
stderror(ERR_SYNTAX);
if (backpid != 0) {
if (dolbang)
- xfree(dolbang);
+ free(dolbang);
setDolp(dolbang = putn(backpid));
}
goto eatbrac;
@@ -595,7 +595,7 @@ Dgetdol(void)
Char *cp = putn(upb - lwb + 1);
addla(cp);
- xfree(cp);
+ free(cp);
}
else {
eatmod:
@@ -718,7 +718,7 @@ setDolp(Char *cp)
(void) Strlcat(np, rhsub, len);
(void) Strlcat(np, dp + lhlen, len);
- xfree(cp);
+ free(cp);
dp = cp = np;
didmod = 1;
} else {
@@ -742,12 +742,12 @@ setDolp(Char *cp)
if ((dp = domod(cp, dolmod[i]))) {
didmod = 1;
if (Strcmp(cp, dp) == 0) {
- xfree(cp);
+ free(cp);
cp = dp;
break;
}
else {
- xfree(cp);
+ free(cp);
cp = dp;
}
}
@@ -765,7 +765,7 @@ setDolp(Char *cp)
if (dp) {
addla(dp);
- xfree(dp);
+ free(dp);
}
else
addla(cp);
Index: error.c
===================================================================
RCS file: /cvs/src/bin/csh/error.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 error.c
--- error.c 8 Feb 2015 05:51:37 -0000 1.11
+++ error.c 12 Nov 2015 14:19:38 -0000
@@ -347,7 +347,7 @@ stderror(int id, ...)
}
if (seterr) {
- xfree(seterr);
+ free(seterr);
seterr = NULL;
}
Index: exec.c
===================================================================
RCS file: /cvs/src/bin/csh/exec.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 exec.c
--- exec.c 28 Oct 2015 22:18:53 -0000 1.18
+++ exec.c 12 Nov 2015 14:19:40 -0000
@@ -159,8 +159,8 @@ doexec(Char **v, struct command *t)
blkfree(t->t_dcom);
t->t_dcom = blkspl(pv, av);
- xfree(pv);
- xfree(av);
+ free(pv);
+ free(av);
av = t->t_dcom;
trim(av);
@@ -216,7 +216,7 @@ doexec(Char **v, struct command *t)
Vdp = dp;
texec(dp, av);
Vdp = 0;
- xfree(dp);
+ free(dp);
}
misses++;
cont:
@@ -225,7 +225,7 @@ cont:
} while (*pv);
hits--;
Vsav = 0;
- xfree(sav);
+ free(sav);
pexerr();
}
@@ -236,7 +236,7 @@ pexerr(void)
if (expath) {
setname(vis_str(expath));
Vexpath = 0;
- xfree(expath);
+ free(expath);
expath = 0;
}
else
@@ -316,7 +316,7 @@ texec(Char *sf, Char **st)
/* The order for the conversions is significant */
t = short2blk(st);
f = short2str(sf);
- xfree(st);
+ free(st);
Vt = t;
(void) execve(f, t, environ);
Vt = 0;
@@ -333,7 +333,7 @@ texec(Char *sf, Char **st)
if (exerr == 0) {
exerr = strerror(errno);
if (expath)
- xfree(expath);
+ free(expath);
expath = Strsave(sf);
Vexpath = expath;
}
@@ -512,13 +512,13 @@ iscommand(Char *name)
}
if (pv[0][0] == 0 || eq(pv[0], STRdot)) { /* don't make ./xxx */
if (executable(NULL, name, 0)) {
- xfree(sav);
+ free(sav);
return i + 1;
}
}
else {
if (executable(*pv, sav, 0)) {
- xfree(sav);
+ free(sav);
return i + 1;
}
}
@@ -526,7 +526,7 @@ cont:
pv++;
i++;
} while (*pv);
- xfree(sav);
+ free(sav);
return 0;
}
@@ -694,7 +694,7 @@ tellmewhat(struct wordent *lexp, Char *s
if (!slash) {
sp->word = Strspl(STRdotsl, sp->word);
prlex(cshout, lexp);
- xfree(sp->word);
+ free(sp->word);
}
else
prlex(cshout, lexp);
@@ -702,12 +702,12 @@ tellmewhat(struct wordent *lexp, Char *s
else {
s1 = Strspl(*pv, STRslash);
sp->word = Strspl(s1, sp->word);
- xfree(s1);
+ free(s1);
if (str == NULL)
prlex(cshout, lexp);
else
(void) Strlcpy(str, sp->word, len/sizeof(Char));
- xfree(sp->word);
+ free(sp->word);
}
found = 1;
}
@@ -723,6 +723,6 @@ tellmewhat(struct wordent *lexp, Char *s
found = 0;
}
sp->word = s0; /* we save and then restore this */
- xfree(cmd);
+ free(cmd);
return found;
}
Index: exp.c
===================================================================
RCS file: /cvs/src/bin/csh/exp.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 exp.c
--- exp.c 26 Oct 2015 22:03:06 -0000 1.15
+++ exp.c 12 Nov 2015 14:19:41 -0000
@@ -183,12 +183,12 @@ exp2c(Char ***vp, bool ignore)
i = !Gmatch(p1, p2);
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (i);
}
i = egetn(p1);
- xfree(p1);
+ free(p1);
return (i);
}
@@ -223,8 +223,8 @@ exp3(Char ***vp, bool ignore)
i = egetn(p1) <= egetn(p2);
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -245,8 +245,8 @@ exp3a(Char ***vp, bool ignore)
i = egetn(p1) << egetn(p2);
else
i = egetn(p1) >> egetn(p2);
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -274,8 +274,8 @@ exp4(Char ***vp, bool ignore)
i = egetn(p1) - egetn(p2);
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -321,8 +321,8 @@ exp5(Char ***vp, bool ignore)
i = l % i;
break;
}
- xfree(p1);
- xfree(p2);
+ free(p1);
+ free(p2);
return (putn(i));
}
return (p1);
@@ -340,14 +340,14 @@ exp6(Char ***vp, bool ignore)
(*vp)++;
cp = exp6(vp, ignore);
i = egetn(cp);
- xfree(cp);
+ free(cp);
return (putn(!i));
}
if (eq(**vp, STRtilde)) {
(*vp)++;
cp = exp6(vp, ignore);
i = egetn(cp);
- xfree(cp);
+ free(cp);
return (putn(~i));
}
if (eq(**vp, STRLparen)) {
@@ -428,7 +428,7 @@ exp6(Char ***vp, bool ignore)
default:
if (cp[1] == 'l' ? lstat(short2str(ep), &stb) :
stat(short2str(ep), &stb)) {
- xfree(ep);
+ free(ep);
return (Strsave(STR0));
}
switch (cp[1]) {
@@ -466,7 +466,7 @@ exp6(Char ***vp, bool ignore)
break;
}
}
- xfree(ep);
+ free(ep);
return (putn(i));
}
return (ignore & NOGLOB ? Strsave(cp) : globone(cp, G_ERROR));
Index: extern.h
===================================================================
RCS file: /cvs/src/bin/csh/extern.h,v
retrieving revision 1.24
diff -u -p -u -r1.24 extern.h
--- extern.h 26 Oct 2015 21:57:42 -0000 1.24
+++ extern.h 12 Nov 2015 14:19:43 -0000
@@ -281,7 +281,6 @@ void psecs(long);
/*
* alloc.c
*/
-void Free(void *);
void * Malloc(size_t);
void * Reallocarray(void *, size_t, size_t);
void * Calloc(size_t, size_t);
Index: file.c
===================================================================
RCS file: /cvs/src/bin/csh/file.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 file.c
--- file.c 26 Oct 2015 15:01:15 -0000 1.22
+++ file.c 12 Nov 2015 14:19:44 -0000
@@ -390,8 +390,8 @@ free_items(Char **items, int numitems)
int i;
for (i = 0; i < numitems; i++)
- xfree(items[i]);
- xfree(items);
+ free(items[i]);
+ free(items);
}
#define FREE_ITEMS(items) { \
Index: func.c
===================================================================
RCS file: /cvs/src/bin/csh/func.c,v
retrieving revision 1.31
diff -u -p -u -r1.31 func.c
--- func.c 26 Oct 2015 16:27:04 -0000 1.31
+++ func.c 12 Nov 2015 14:19:46 -0000
@@ -127,7 +127,7 @@ doonintr(Char **v, struct command *t)
stderror(ERR_NAME | ERR_TERMINAL);
cp = gointr;
gointr = 0;
- xfree(cp);
+ free(cp);
if (vv == 0) {
if (setintr) {
sigemptyset(&sigset);
@@ -300,7 +300,7 @@ dogoto(Char **v, struct command *t)
Char *lp;
gotolab(lp = globone(v[1], G_ERROR));
- xfree(lp);
+ free(lp);
}
void
@@ -341,7 +341,7 @@ doswitch(Char **v, struct command *t)
if (*v)
stderror(ERR_SYNTAX);
search(T_SWITCH, 0, lp = globone(cp, G_ERROR));
- xfree(lp);
+ free(lp);
}
void
@@ -659,7 +659,7 @@ search(int type, int level, Char *goal)
cp = strip(Dfix1(aword));
if (Gmatch(goal, cp))
level = -1;
- xfree(cp);
+ free(cp);
break;
case T_DEFAULT:
@@ -824,8 +824,8 @@ wfree(void)
if (wp->w_fe0)
blkfree(wp->w_fe0);
if (wp->w_fename)
- xfree(wp->w_fename);
- xfree(wp);
+ free(wp->w_fename);
+ free(wp);
}
}
@@ -917,7 +917,7 @@ dosetenv(Char **v, struct command *t)
importpath(lp);
dohash(NULL, NULL);
}
- xfree(lp);
+ free(lp);
}
void
@@ -929,7 +929,7 @@ dounsetenv(Char **v, struct command *t)
static Char *name = NULL;
if (name)
- xfree(name);
+ free(name);
/*
* Find the longest environment variable
*/
@@ -957,7 +957,7 @@ dounsetenv(Char **v, struct command *t)
Unsetenv(name);
break;
}
- xfree(name);
+ free(name);
name = NULL;
}
@@ -975,21 +975,21 @@ Setenv(Char *name, Char *val)
if (*cp != 0 || *dp != '=')
continue;
cp = Strspl(STRequal, val);
- xfree(* ep);
+ free(* ep);
*ep = strip(Strspl(name, cp));
- xfree(cp);
+ free(cp);
blkfree((Char **) environ);
environ = short2blk(STR_environ);
return;
}
cp = Strspl(name, STRequal);
blk[0] = strip(Strspl(cp, val));
- xfree(cp);
+ free(cp);
blk[1] = 0;
STR_environ = blkspl(STR_environ, blk);
blkfree((Char **) environ);
environ = short2blk(STR_environ);
- xfree(oep);
+ free(oep);
}
static void
@@ -1009,8 +1009,8 @@ Unsetenv(Char *name)
STR_environ = blkspl(STR_environ, ep + 1);
environ = short2blk(STR_environ);
*ep = cp;
- xfree(cp);
- xfree(oep);
+ free(cp);
+ free(oep);
return;
}
}
Index: glob.c
===================================================================
RCS file: /cvs/src/bin/csh/glob.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 glob.c
--- glob.c 26 Oct 2015 22:03:06 -0000 1.20
+++ glob.c 12 Nov 2015 14:19:47 -0000
@@ -110,7 +110,7 @@ globtilde(Char **nv, Char *s)
*b++ = *s++;
*b = EOS;
--u;
- xfree(u);
+ free(u);
return (Strsave(gstart));
}
@@ -228,13 +228,13 @@ expbrace(Char ***nvp, Char ***elp, int s
int len;
if ((len = globbrace(s, b, &bl)) < 0) {
- xfree(nv);
+ free(nv);
stderror(ERR_MISSING, -len);
}
- xfree(s);
+ free(s);
if (len == 1) {
*vl-- = *bl;
- xfree(bl);
+ free(bl);
continue;
}
len = blklen(bl);
@@ -258,7 +258,7 @@ expbrace(Char ***nvp, Char ***elp, int s
vp++;
for (bp = bl + 1; *bp; *vp++ = *bp++)
continue;
- xfree(bl);
+ free(bl);
}
}
@@ -294,7 +294,7 @@ globexpand(Char **v)
vl = &nv[size - GLOBSPACE];
}
}
- xfree(pargv);
+ free(pargv);
pargv = NULL;
}
else {
@@ -345,9 +345,9 @@ handleone(Char *str, Char **vl, int acti
str = Strsave(*vlp++);
do {
cp = Strspl(str, STRspace);
- xfree(str);
+ free(str);
str = Strspl(cp, *vlp);
- xfree(cp);
+ free(cp);
}
while (*++vlp)
;
@@ -430,14 +430,14 @@ globone(Char *str, int action)
vo = globexpand(v);
if (noglob || (gflg & G_GLOB) == 0) {
if (vo[0] == NULL) {
- xfree(vo);
+ free(vo);
return (Strsave(STRNULL));
}
if (vo[1] != NULL)
return (handleone(str, vo, action));
else {
str = strip(vo[0]);
- xfree(vo);
+ free(vo);
return (str);
}
}
@@ -455,14 +455,14 @@ globone(Char *str, int action)
stderror(ERR_NAME | ERR_NOMATCH);
}
if (vl[0] == NULL) {
- xfree(vl);
+ free(vl);
return (Strsave(STRNULL));
}
if (vl[1] != NULL)
return (handleone(str, vl, action));
else {
str = strip(*vl);
- xfree(vl);
+ free(vl);
return (str);
}
}
@@ -692,7 +692,7 @@ backeval(Char *cp, bool literal)
execute(t, -1, NULL, NULL);
exitstat();
}
- xfree(cp);
+ free(cp);
(void) close(pvec[1]);
c = 0;
ip = NULL;
Index: hist.c
===================================================================
RCS file: /cvs/src/bin/csh/hist.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 hist.c
--- hist.c 8 Feb 2015 05:51:37 -0000 1.9
+++ hist.c 12 Nov 2015 14:19:49 -0000
@@ -97,7 +97,7 @@ hfree(struct Hist *hp)
{
freelex(&hp->Hlex);
- xfree(hp);
+ free(hp);
}
void
Index: lex.c
===================================================================
RCS file: /cvs/src/bin/csh/lex.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 lex.c
--- lex.c 26 Oct 2015 22:03:06 -0000 1.20
+++ lex.c 12 Nov 2015 14:19:52 -0000
@@ -211,8 +211,8 @@ freelex(struct wordent *vp)
while (vp->next != vp) {
fp = vp->next;
vp->next = fp->next;
- xfree(fp->word);
- xfree(fp);
+ free(fp->word);
+ free(fp);
}
vp->prev = vp;
}
@@ -847,11 +847,11 @@ dosub(int sc, struct wordent *en, bool g
otword = tword;
tword = subword(otword, sc, &didone);
if (Strcmp(tword, otword) == 0) {
- xfree(otword);
+ free(otword);
break;
}
else
- xfree(otword);
+ free(otword);
}
}
}
@@ -1413,7 +1413,7 @@ again:
if (fbuf) {
(void) blkcpy(nfbuf, fbuf);
- xfree(fbuf);
+ free(fbuf);
}
fbuf = nfbuf;
fbuf[fblocks] = xcalloc(BUFSIZ, sizeof(Char));
@@ -1483,7 +1483,7 @@ bfree(void)
sb = (int) (fseekp - 1) / BUFSIZ;
if (sb > 0) {
for (i = 0; i < sb; i++)
- xfree(fbuf[i]);
+ free(fbuf[i]);
(void) blkcpy(fbuf, &fbuf[sb]);
fseekp -= BUFSIZ * sb;
feobp -= BUFSIZ * sb;
Index: misc.c
===================================================================
RCS file: /cvs/src/bin/csh/misc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 misc.c
--- misc.c 26 Oct 2015 22:03:06 -0000 1.17
+++ misc.c 12 Nov 2015 14:19:55 -0000
@@ -124,8 +124,8 @@ blkfree(Char **av0)
if (!av0)
return;
for (; *av; av++)
- xfree(* av);
- xfree(av0);
+ free(* av);
+ free(av0);
}
Char **
@@ -252,7 +252,7 @@ lshift(Char **v, int c)
Char **u;
for (u = v; *u && --c >= 0; u++)
- xfree(*u);
+ free(*u);
(void) blkcpy(v, u);
}
Index: parse.c
===================================================================
RCS file: /cvs/src/bin/csh/parse.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 parse.c
--- parse.c 8 Feb 2015 06:09:50 -0000 1.11
+++ parse.c 12 Nov 2015 14:19:57 -0000
@@ -170,7 +170,7 @@ asyn3(struct wordent *p1, struct wordent
Char *cp = alout.next->word;
alout.next->word = Strspl(STRQNULL, cp);
- xfree(cp);
+ free(cp);
}
p1 = freenod(p1, redid ? p2 : p1->next);
if (alout.next != &alout) {
@@ -178,8 +178,8 @@ asyn3(struct wordent *p1, struct wordent
alout.prev->prev->next = p1->next;
alout.next->prev = p1;
p1->next = alout.next;
- xfree(alout.prev->word);
- xfree((alout.prev));
+ free(alout.prev->word);
+ free((alout.prev));
}
reset(); /* throw! */
}
@@ -190,9 +190,9 @@ freenod(struct wordent *p1, struct worde
struct wordent *retp = p1->prev;
while (p1 != p2) {
- xfree(p1->word);
+ free(p1->word);
p1 = p1->next;
- xfree((p1->prev));
+ free((p1->prev));
}
retp->next = p2;
p2->prev = retp;
@@ -645,15 +645,15 @@ freesyn(struct command *t)
case NODE_COMMAND:
for (v = t->t_dcom; *v; v++)
- xfree(* v);
- xfree((t->t_dcom));
- xfree(t->t_dlef);
- xfree(t->t_drit);
+ free(* v);
+ free((t->t_dcom));
+ free(t->t_dlef);
+ free(t->t_drit);
break;
case NODE_PAREN:
freesyn(t->t_dspr);
- xfree(t->t_dlef);
- xfree(t->t_drit);
+ free(t->t_dlef);
+ free(t->t_drit);
break;
case NODE_AND:
@@ -663,5 +663,5 @@ freesyn(struct command *t)
freesyn(t->t_dcar), freesyn(t->t_dcdr);
break;
}
- xfree(t);
+ free(t);
}
Index: proc.c
===================================================================
RCS file: /cvs/src/bin/csh/proc.c,v
retrieving revision 1.29
diff -u -p -u -r1.29 proc.c
--- proc.c 26 Oct 2015 22:03:06 -0000 1.29
+++ proc.c 12 Nov 2015 14:20:01 -0000
@@ -227,11 +227,11 @@ pwait(void)
for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
if (pp->p_pid == 0) {
fp->p_next = pp->p_next;
- xfree(pp->p_command);
+ free(pp->p_command);
if (pp->p_cwd && --pp->p_cwd->di_count == 0)
if (pp->p_cwd->di_next == 0)
dfree(pp->p_cwd);
- xfree(pp);
+ free(pp);
pp = fp;
}
sigprocmask(SIG_SETMASK, &osigset, NULL);
Index: sem.c
===================================================================
RCS file: /cvs/src/bin/csh/sem.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 sem.c
--- sem.c 26 Oct 2015 22:03:06 -0000 1.20
+++ sem.c 12 Nov 2015 14:20:05 -0000
@@ -273,11 +273,11 @@ execute(struct command *t, int wanttty,
csigset = ocsigset;
nosigchld = onosigchld;
- xfree(Vsav);
+ free(Vsav);
Vsav = NULL;
- xfree(Vdp);
+ free(Vdp);
Vdp = NULL;
- xfree(Vexpath);
+ free(Vexpath);
Vexpath = NULL;
blkfree((Char **) Vt);
Vt = NULL;
@@ -483,23 +483,23 @@ splicepipe(struct command *t, Char *cp)
pv = globall(blk);
if (pv == NULL) {
setname(vis_str(blk[0]));
- xfree(blk[0]);
+ free(blk[0]);
stderror(ERR_NAME | ERR_NOMATCH);
}
gargv = NULL;
if (pv[1] != NULL) { /* we need to fix the command vector */
Char **av = blkspl(t->t_dcom, &pv[1]);
- xfree(t->t_dcom);
+ free(t->t_dcom);
t->t_dcom = av;
}
- xfree(blk[0]);
+ free(blk[0]);
blk[0] = pv[0];
- xfree(pv);
+ free(pv);
}
}
else {
blk[0] = globone(blk[1] = Dfix1(cp), G_ERROR);
- xfree(blk[1]);
+ free(blk[1]);
}
return(blk[0]);
}
@@ -529,7 +529,7 @@ doio(struct command *t, int *pipein, int
(void) dcopy(SHERR, 2);
cp = splicepipe(t, t->t_dlef);
strlcpy(tmp, short2str(cp), sizeof tmp);
- xfree(cp);
+ free(cp);
if ((fd = open(tmp, O_RDONLY)) < 0)
stderror(ERR_SYSTEM, tmp, strerror(errno));
(void) dmove(fd, 0);
@@ -555,7 +555,7 @@ doio(struct command *t, int *pipein, int
cp = splicepipe(t, t->t_drit);
strlcpy(tmp, short2str(cp), sizeof tmp);
- xfree(cp);
+ free(cp);
/*
* so > /dev/std{out,err} work
*/
Index: set.c
===================================================================
RCS file: /cvs/src/bin/csh/set.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 set.c
--- set.c 26 Oct 2015 22:03:06 -0000 1.18
+++ set.c 12 Nov 2015 14:20:08 -0000
@@ -156,7 +156,7 @@ doset(Char **v, struct command *t)
Setenv(STRHOME, cp);
/* fix directory stack for new tilde home */
dtilde();
- xfree(cp);
+ free(cp);
}
else if (eq(vp, STRfilec))
filec = 1;
@@ -181,7 +181,7 @@ asx(Char *vp, int subscr, Char *p)
{
struct varent *v = getvx(vp, subscr);
- xfree(v->vec[subscr - 1]);
+ free(v->vec[subscr - 1]);
v->vec[subscr - 1] = globone(p, G_APPEND);
}
@@ -276,9 +276,9 @@ dolet(Char **v, struct command *t)
exportpath(adrof(STRpath)->vec);
dohash(NULL, NULL);
}
- xfree(vp);
+ free(vp);
if (c != '=')
- xfree(p);
+ free(p);
} while ((p = *v++) != NULL);
}
@@ -290,7 +290,7 @@ xset(Char *cp, Char ***vp)
if (*cp) {
dp = Strsave(cp);
--(*vp);
- xfree(** vp);
+ free(** vp);
**vp = dp;
}
return (putn(expr(vp)));
@@ -505,7 +505,7 @@ unsetv1(struct varent *p)
* Free associated memory first to avoid complications.
*/
blkfree(p->vec);
- xfree(p->v_name);
+ free(p->v_name);
/*
* If p is missing one child, then we can move the other into where p is.
* Otherwise, we find the predecessor of p, which is guaranteed to have no
@@ -533,7 +533,7 @@ unsetv1(struct varent *p)
/*
* Free the deleted node, and rebalance.
*/
- xfree(p);
+ free(p);
balance(pp, f, 1);
}
Best regards,
Ricardo Mestre