#define STADJUST(amount, p) (p += (amount), sstrnleft -= (amount))
#define grabstackstr(p) stalloc(stackblocksize() - sstrnleft)
-#define ckfree(p) free((pointer)(p))
#ifdef DEBUG
INTOFF;
if (ap) {
if (!(ap->flag & ALIASINUSE)) {
- ckfree(ap->val);
+ free(ap->val);
}
ap->val = xstrdup(val);
ap->flag &= ~ALIASDEAD;
}
next = ap->next;
- ckfree(ap->name);
- ckfree(ap->val);
- ckfree(ap);
+ free(ap->name);
+ free(ap->val);
+ free(ap);
return next;
}
return copynode(n);
}
-/*
- * Free a parse tree.
- */
-
-static void
-freefunc(union node *n)
-{
- if (n)
- ckfree(n);
-}
-
-
/*
* Add a new command entry, replacing any existing command entry for
* the same name.
INTOFF;
cmdp = cmdlookup(name, 1);
if (cmdp->cmdtype == CMDFUNCTION) {
- freefunc(cmdp->param.func);
+ free(cmdp->param.func);
}
cmdp->cmdtype = entry->cmdtype;
cmdp->param = entry->u;
for (tp = trap ; tp < &trap[NSIG] ; tp++) {
if (*tp && **tp) { /* trap not NULL or SIG_IGN */
INTOFF;
- ckfree(*tp);
+ free(*tp);
*tp = NULL;
if (tp != &trap[0])
setsignal(tp - trap);
INTOFF;
if (pf->fd >= 0)
close(pf->fd);
- if (pf->buf)
- ckfree(pf->buf);
+ free(pf->buf);
while (pf->strpush)
popstring();
parsefile = pf->prev;
- ckfree(pf);
+ free(pf);
parsenleft = parsefile->nleft;
parselleft = parsefile->lleft;
parsenextc = parsefile->nextc;
out1str("a function\n");
name = commandtext(cmdp->param.func);
printf("%s() {\n %s\n}", cmdp->cmdname, name);
- ckfree(name);
+ free(name);
INTON;
}
#ifdef DEBUG
|| (cmdp->cmdtype == CMDBUILTIN &&
builtinloc >= firstchange)) {
*pp = cmdp->next;
- ckfree(cmdp);
+ free(cmdp);
} else {
pp = &cmdp->next;
}
while ((cmdp = *pp) != NULL) {
if (cmdp->cmdtype == CMDFUNCTION) {
*pp = cmdp->next;
- freefunc(cmdp->param.func);
- ckfree(cmdp);
+ free(cmdp->param.func);
+ free(cmdp);
} else {
pp = &cmdp->next;
}
INTOFF;
cmdp = *lastcmdentry;
*lastcmdentry = cmdp->next;
- ckfree(cmdp);
+ free(cmdp);
INTON;
}
struct tblentry *cmdp;
if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) {
- freefunc(cmdp->param.func);
+ free(cmdp->param.func);
delete_cmd_entry();
}
}
struct ifsregion *ifsp;
INTOFF;
ifsp = ifsfirst.next->next;
- ckfree(ifsfirst.next);
+ free(ifsfirst.next);
ifsfirst.next = ifsp;
INTON;
}
struct ifsregion *ifsp;
INTOFF;
ifsp = ifslastp->next->next;
- ckfree(ifslastp->next);
+ free(ifslastp->next);
ifslastp->next = ifsp;
INTON;
}
err2:
if (in.fd >= 0)
close(in.fd);
- if (in.buf)
- ckfree(in.buf);
+ free(in.buf);
if (in.jp)
exitstatus = waitforjob(in.jp);
handler = savehandler;
struct ifsregion *ifsp;
INTOFF;
ifsp = ifsfirst.next->next;
- ckfree(ifsfirst.next);
+ free(ifsfirst.next);
ifsfirst.next = ifsp;
INTON;
}
}
expmeta(expdir, str->text);
- ckfree(expdir);
+ free(expdir);
expdir = NULL;
INTON;
if (exparg.lastp == savelastp) {
}
}
if (sp->string != sp->ap->val) {
- ckfree(sp->string);
+ free(sp->string);
}
sp->ap->flag &= ~ALIASINUSE;
/*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
parsefile->strpush = sp->prev;
if (sp != &(parsefile->basestrpush))
- ckfree(sp);
+ free(sp);
INTON;
}
INTOFF;
for (i = jp->nprocs, ps = jp->ps ; --i >= 0 ; ps++) {
if (ps->cmd != nullstr)
- ckfree(ps->cmd);
+ free(ps->cmd);
}
if (jp->ps != &jp->ps0)
- ckfree(jp->ps);
+ free(jp->ps);
jp->used = 0;
#ifdef CONFIG_ASH_JOB_CONTROL
if (curjob == jp - jobtab + 1)
for (i = 0; i < njobs; i++)
if (jp[i].ps == &jobtab[i].ps0)
jp[i].ps = &jp[i].ps0;
- ckfree(jobtab);
+ free(jobtab);
jobtab = jp;
}
jp = jobtab + njobs;
static void waitonint(int sig) {
intreceived = 1;
- return;
}
#ifdef CONFIG_ASH_MAIL
while (stackp != mark->stackp) {
sp = stackp;
stackp = sp->prev;
- ckfree(sp);
+ free(sp);
}
stacknxt = mark->stacknxt;
stacknleft = mark->stacknleft;
if (param->malloc) {
for (ap = param->p ; *ap ; ap++)
- ckfree(*ap);
- ckfree(param->p);
+ free(*ap);
+ free(param->p);
}
}
shellparam.nparam -= n;
for (ap1 = shellparam.p ; --n >= 0 ; ap1++) {
if (shellparam.malloc)
- ckfree(*ap1);
+ free(*ap1);
}
ap2 = shellparam.p;
while ((*ap2++ = *ap1++) != NULL);
savepbq = parsebackquote;
if (setjmp(jmploc.loc)) {
- if (str)
- ckfree(str);
+ free(str);
parsebackquote = 0;
handler = savehandler;
longjmp(handler->loc, 1);
memcpy(out, str, savelen);
STADJUST(savelen, out);
INTOFF;
- ckfree(str);
+ free(str);
str = NULL;
INTON;
}
}
}
redirlist = rp->next;
- ckfree(rp);
+ free(rp);
INTON;
}
else
action = xstrdup(action);
}
- if (trap[signo])
- ckfree(trap[signo]);
+ free(trap[signo]);
trap[signo] = action;
if (signo != 0)
setsignal(signo);
(*vp->func)(strchr(s, '=') + 1);
if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0)
- ckfree(vp->text);
+ free(vp->text);
vp->flags &= ~(VTEXTFIXED|VSTACK|VUNSET);
vp->flags |= flags;
if ((vp->flags & VEXPORT) == 0) {
*prev = vp->next;
if ((vp->flags & VTEXTFIXED) == 0)
- ckfree(vp->text);
+ free(vp->text);
if ((vp->flags & VSTRFIXED) == 0)
- ckfree(vp);
+ free(vp);
} else {
if (vp->flags & VSTACK) {
vp->text = xstrdup(vp->text);
vp = lvp->vp;
if (vp == NULL) { /* $- saved */
memcpy(optet_vals, lvp->text, sizeof optet_vals);
- ckfree(lvp->text);
+ free(lvp->text);
} else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) {
(void)unsetvar(vp->text);
} else {
if ((vp->flags & VTEXTFIXED) == 0)
- ckfree(vp->text);
+ free(vp->text);
vp->flags = lvp->flags;
vp->text = lvp->text;
}
- ckfree(lvp);
+ free(lvp);
}
}
vp->flags |= VUNSET;
if ((vp->flags & VSTRFIXED) == 0) {
if ((vp->flags & VTEXTFIXED) == 0)
- ckfree(vp->text);
+ free(vp->text);
*vpp = vp->next;
- ckfree(vp);
+ free(vp);
}
INTON;
return (0);
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.55 2002/07/11 11:11:51 andersen Exp $
+ * $Id: ash.c,v 1.56 2002/08/02 06:39:47 aaronl Exp $
*/
static int timescmd (int argc, char **argv)
{