summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormestre <mestre@openbsd.org>2015-12-26 13:48:38 +0000
committermestre <mestre@openbsd.org>2015-12-26 13:48:38 +0000
commitacdb32028ee917f8269a9fd16c4817e3a7408b91 (patch)
tree96c97b1d977e5bf0fb28d9cfb799fa0ec5418337
parentRemove blank line for consistency with other rc.d scripts; no change in (diff)
downloadwireguard-openbsd-acdb32028ee917f8269a9fd16c4817e3a7408b91.tar.xz
wireguard-openbsd-acdb32028ee917f8269a9fd16c4817e3a7408b91.zip
Replace handrolled xfree() function by directly using free(3)
OK mmcc@
-rw-r--r--bin/csh/alloc.c8
-rw-r--r--bin/csh/csh.c14
-rw-r--r--bin/csh/csh.h3
-rw-r--r--bin/csh/dir.c28
-rw-r--r--bin/csh/dol.c14
-rw-r--r--bin/csh/error.c4
-rw-r--r--bin/csh/exec.c30
-rw-r--r--bin/csh/exp.c32
-rw-r--r--bin/csh/extern.h3
-rw-r--r--bin/csh/file.c6
-rw-r--r--bin/csh/func.c32
-rw-r--r--bin/csh/glob.c28
-rw-r--r--bin/csh/hist.c4
-rw-r--r--bin/csh/lex.c14
-rw-r--r--bin/csh/misc.c8
-rw-r--r--bin/csh/parse.c26
-rw-r--r--bin/csh/proc.c6
-rw-r--r--bin/csh/sem.c22
-rw-r--r--bin/csh/set.c16
19 files changed, 145 insertions, 153 deletions
diff --git a/bin/csh/alloc.c b/bin/csh/alloc.c
index e59597970a4..9fec5a43b7f 100644
--- a/bin/csh/alloc.c
+++ b/bin/csh/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.16 2015/02/08 06:01:25 tedu Exp $ */
+/* $OpenBSD: alloc.c,v 1.17 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: alloc.c,v 1.6 1995/03/21 09:02:23 cgd Exp $ */
/*-
@@ -74,9 +74,3 @@ Calloc(size_t s, size_t n)
return (ptr);
}
-
-void
-Free(void *p)
-{
- free(p);
-}
diff --git a/bin/csh/csh.c b/bin/csh/csh.c
index 09a34859054..e1b667b0fd1 100644
--- a/bin/csh/csh.c
+++ b/bin/csh/csh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.c,v 1.36 2015/11/11 02:52:46 deraadt Exp $ */
+/* $OpenBSD: csh.c,v 1.37 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */
/*-
@@ -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 hflg)
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));
}
diff --git a/bin/csh/csh.h b/bin/csh/csh.h
index b928c8871c3..e34a04a6f09 100644
--- a/bin/csh/csh.h
+++ b/bin/csh/csh.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.h,v 1.27 2015/10/28 22:18:53 naddy Exp $ */
+/* $OpenBSD: csh.h,v 1.28 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: csh.h,v 1.9 1995/03/21 09:02:40 cgd Exp $ */
/*-
@@ -72,7 +72,6 @@ typedef void *ioctl_t; /* Third arg of ioctl */
#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;
diff --git a/bin/csh/dir.c b/bin/csh/dir.c
index fdee8eae971..3303b539227 100644
--- a/bin/csh/dir.c
+++ b/bin/csh/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.20 2015/02/08 06:09:50 tedu Exp $ */
+/* $OpenBSD: dir.c,v 1.21 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: dir.c,v 1.9 1995/03/21 09:02:42 cgd Exp $ */
/*-
@@ -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;
}
}
diff --git a/bin/csh/dol.c b/bin/csh/dol.c
index 8a5fe14f4ea..5eb3ee1f95e 100644
--- a/bin/csh/dol.c
+++ b/bin/csh/dol.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dol.c,v 1.19 2015/02/08 05:51:37 tedu Exp $ */
+/* $OpenBSD: dol.c,v 1.20 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */
/*-
@@ -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);
diff --git a/bin/csh/error.c b/bin/csh/error.c
index e72030a5f37..88bed5b154b 100644
--- a/bin/csh/error.c
+++ b/bin/csh/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.11 2015/02/08 05:51:37 tedu Exp $ */
+/* $OpenBSD: error.c,v 1.12 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: err.c,v 1.6 1995/03/21 09:02:47 cgd Exp $ */
/*-
@@ -347,7 +347,7 @@ stderror(int id, ...)
}
if (seterr) {
- xfree(seterr);
+ free(seterr);
seterr = NULL;
}
diff --git a/bin/csh/exec.c b/bin/csh/exec.c
index f9436f1433d..fe12855f7a2 100644
--- a/bin/csh/exec.c
+++ b/bin/csh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.18 2015/10/28 22:18:53 naddy Exp $ */
+/* $OpenBSD: exec.c,v 1.19 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: exec.c,v 1.9 1996/09/30 20:03:54 christos Exp $ */
/*-
@@ -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 *str, int len)
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 *str, int len)
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 *str, int len)
found = 0;
}
sp->word = s0; /* we save and then restore this */
- xfree(cmd);
+ free(cmd);
return found;
}
diff --git a/bin/csh/exp.c b/bin/csh/exp.c
index dbd0550af6b..33c4d817f91 100644
--- a/bin/csh/exp.c
+++ b/bin/csh/exp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exp.c,v 1.15 2015/10/26 22:03:06 naddy Exp $ */
+/* $OpenBSD: exp.c,v 1.16 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: exp.c,v 1.6 1995/03/21 09:02:51 cgd Exp $ */
/*-
@@ -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));
diff --git a/bin/csh/extern.h b/bin/csh/extern.h
index a791039f5ff..f6c64817ff6 100644
--- a/bin/csh/extern.h
+++ b/bin/csh/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.24 2015/10/26 21:57:42 naddy Exp $ */
+/* $OpenBSD: extern.h,v 1.25 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: extern.h,v 1.8 1996/10/31 23:50:54 christos Exp $ */
/*-
@@ -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);
diff --git a/bin/csh/file.c b/bin/csh/file.c
index 49cb46701ae..c077e3aa891 100644
--- a/bin/csh/file.c
+++ b/bin/csh/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.22 2015/10/26 15:01:15 naddy Exp $ */
+/* $OpenBSD: file.c,v 1.23 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: file.c,v 1.11 1996/11/08 19:34:37 christos Exp $ */
/*-
@@ -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) { \
diff --git a/bin/csh/func.c b/bin/csh/func.c
index 376eed964da..db3ac547cd0 100644
--- a/bin/csh/func.c
+++ b/bin/csh/func.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: func.c,v 1.31 2015/10/26 16:27:04 naddy Exp $ */
+/* $OpenBSD: func.c,v 1.32 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */
/*-
@@ -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;
}
}
diff --git a/bin/csh/glob.c b/bin/csh/glob.c
index c21c56559c0..6dc529580ac 100644
--- a/bin/csh/glob.c
+++ b/bin/csh/glob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glob.c,v 1.21 2015/12/22 08:18:36 mmcc Exp $ */
+/* $OpenBSD: glob.c,v 1.22 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: glob.c,v 1.10 1995/03/21 09:03:01 cgd Exp $ */
/*-
@@ -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 size)
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 size)
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 action)
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;
diff --git a/bin/csh/hist.c b/bin/csh/hist.c
index d1052fea160..5b3edc0eb8a 100644
--- a/bin/csh/hist.c
+++ b/bin/csh/hist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hist.c,v 1.9 2015/02/08 05:51:37 tedu Exp $ */
+/* $OpenBSD: hist.c,v 1.10 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: hist.c,v 1.7 1995/03/21 18:35:44 mycroft Exp $ */
/*-
@@ -97,7 +97,7 @@ hfree(struct Hist *hp)
{
freelex(&hp->Hlex);
- xfree(hp);
+ free(hp);
}
void
diff --git a/bin/csh/lex.c b/bin/csh/lex.c
index 895106f6144..72f0a8301f3 100644
--- a/bin/csh/lex.c
+++ b/bin/csh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.20 2015/10/26 22:03:06 naddy Exp $ */
+/* $OpenBSD: lex.c,v 1.21 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: lex.c,v 1.9 1995/09/27 00:38:46 jtc Exp $ */
/*-
@@ -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 global)
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;
diff --git a/bin/csh/misc.c b/bin/csh/misc.c
index 5a82eb29c25..3a3ab323090 100644
--- a/bin/csh/misc.c
+++ b/bin/csh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.17 2015/10/26 22:03:06 naddy Exp $ */
+/* $OpenBSD: misc.c,v 1.18 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: misc.c,v 1.6 1995/03/21 09:03:09 cgd Exp $ */
/*-
@@ -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);
}
diff --git a/bin/csh/parse.c b/bin/csh/parse.c
index ec86c7c8d29..363fa94a0d3 100644
--- a/bin/csh/parse.c
+++ b/bin/csh/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.11 2015/02/08 06:09:50 tedu Exp $ */
+/* $OpenBSD: parse.c,v 1.12 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: parse.c,v 1.6 1995/03/21 09:03:10 cgd Exp $ */
/*-
@@ -170,7 +170,7 @@ asyn3(struct wordent *p1, struct wordent *p2)
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 *p2)
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 wordent *p2)
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);
}
diff --git a/bin/csh/proc.c b/bin/csh/proc.c
index 875cca9e6a2..7759edce234 100644
--- a/bin/csh/proc.c
+++ b/bin/csh/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.29 2015/10/26 22:03:06 naddy Exp $ */
+/* $OpenBSD: proc.c,v 1.30 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */
/*-
@@ -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);
diff --git a/bin/csh/sem.c b/bin/csh/sem.c
index d60c23d3178..0dab2ded63d 100644
--- a/bin/csh/sem.c
+++ b/bin/csh/sem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem.c,v 1.20 2015/10/26 22:03:06 naddy Exp $ */
+/* $OpenBSD: sem.c,v 1.21 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: sem.c,v 1.9 1995/09/27 00:38:50 jtc Exp $ */
/*-
@@ -273,11 +273,11 @@ execute(struct command *t, int wanttty, int *pipein, int *pipeout)
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) /* word after < or > */
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 *pipeout)
(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 *pipeout)
cp = splicepipe(t, t->t_drit);
strlcpy(tmp, short2str(cp), sizeof tmp);
- xfree(cp);
+ free(cp);
/*
* so > /dev/std{out,err} work
*/
diff --git a/bin/csh/set.c b/bin/csh/set.c
index 81bfb5a385c..eda0f3e3f55 100644
--- a/bin/csh/set.c
+++ b/bin/csh/set.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: set.c,v 1.18 2015/10/26 22:03:06 naddy Exp $ */
+/* $OpenBSD: set.c,v 1.19 2015/12/26 13:48:38 mestre Exp $ */
/* $NetBSD: set.c,v 1.8 1995/03/21 18:35:52 mycroft Exp $ */
/*-
@@ -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);
}