struct var *vp;
INT_OFF;
- lvp = ckmalloc(sizeof(struct localvar));
+ lvp = ckzalloc(sizeof(struct localvar));
if (LONE_DASH(name)) {
char *p;
p = ckmalloc(sizeof(optlist));
INT_OFF;
/*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
if (parsefile->strpush) {
- sp = ckmalloc(sizeof(struct strpush));
+ sp = ckzmalloc(sizeof(struct strpush));
sp->prev = parsefile->strpush;
parsefile->strpush = sp;
} else
struct heredoc {
struct heredoc *next; /* next here document in list */
- union node *here; /* redirection node */
+ union node *here; /* redirection node */
char *eofmark; /* string indicating end of input */
int striptabs; /* if set, strip leading tabs */
};
if (n1 == NULL) {
n1 = n2;
} else {
- n3 = stalloc(sizeof(struct nbinary));
+ n3 = stzalloc(sizeof(struct nbinary));
n3->type = NSEMI;
n3->nbinary.ch1 = n1;
n3->nbinary.ch2 = n2;
}
checkkwd = CHKNL | CHKKWD | CHKALIAS;
n2 = pipeline();
- n3 = stalloc(sizeof(struct nbinary));
+ n3 = stzalloc(sizeof(struct nbinary));
n3->type = t;
n3->nbinary.ch1 = n1;
n3->nbinary.ch2 = n2;
pipenode = stzalloc(sizeof(struct npipe));
pipenode->type = NPIPE;
/*pipenode->npipe.backgnd = 0; - stzalloc did it */
- lp = stalloc(sizeof(struct nodelist));
+ lp = stzalloc(sizeof(struct nodelist));
pipenode->npipe.cmdlist = lp;
lp->n = n1;
do {
prev = lp;
- lp = stalloc(sizeof(struct nodelist));
+ lp = stzalloc(sizeof(struct nodelist));
checkkwd = CHKNL | CHKKWD | CHKALIAS;
lp->n = parse_command();
prev->next = lp;
}
tokpushback = 1;
if (negate) {
- n2 = stalloc(sizeof(struct nnot));
+ n2 = stzalloc(sizeof(struct nnot));
n2->type = NNOT;
n2->nnot.com = n1;
return n2;
if (heredoclist == NULL)
heredoclist = here;
else {
- for (p = heredoclist; p->next; p = p->next);
+ for (p = heredoclist; p->next; p = p->next)
+ continue;
p->next = here;
}
} else if (n->type == NTOFD || n->type == NFROMFD) {
*app = NULL;
*vpp = NULL;
*rpp = NULL;
- n = stalloc(sizeof(struct ncmd));
+ n = stzalloc(sizeof(struct ncmd));
n->type = NCMD;
n->ncmd.args = args;
n->ncmd.assign = vars;
raise_error_unexpected_syntax(-1);
/* NOTREACHED */
case TIF:
- n1 = stalloc(sizeof(struct nif));
+ n1 = stzalloc(sizeof(struct nif));
n1->type = NIF;
n1->nif.test = list(0);
if (readtoken() != TTHEN)
n1->nif.ifpart = list(0);
n2 = n1;
while (readtoken() == TELIF) {
- n2->nif.elsepart = stalloc(sizeof(struct nif));
+ n2->nif.elsepart = stzalloc(sizeof(struct nif));
n2 = n2->nif.elsepart;
n2->type = NIF;
n2->nif.test = list(0);
case TWHILE:
case TUNTIL: {
int got;
- n1 = stalloc(sizeof(struct nbinary));
+ n1 = stzalloc(sizeof(struct nbinary));
n1->type = (lasttoken == TWHILE) ? NWHILE : NUNTIL;
n1->nbinary.ch1 = list(0);
got = readtoken();
case TFOR:
if (readtoken() != TWORD || quoteflag || ! goodname(wordtext))
raise_error_syntax("Bad for loop variable");
- n1 = stalloc(sizeof(struct nfor));
+ n1 = stzalloc(sizeof(struct nfor));
n1->type = NFOR;
n1->nfor.var = wordtext;
checkkwd = CHKKWD | CHKALIAS;
t = TDONE;
break;
case TCASE:
- n1 = stalloc(sizeof(struct ncase));
+ n1 = stzalloc(sizeof(struct ncase));
n1->type = NCASE;
if (readtoken() != TWORD)
raise_error_unexpected_syntax(TWORD);
while (t != TESAC) {
if (lasttoken == TLP)
readtoken();
- *cpp = cp = stalloc(sizeof(struct nclist));
+ *cpp = cp = stzalloc(sizeof(struct nclist));
cp->type = NCLIST;
app = &cp->nclist.pattern;
for (;;) {
/*np->nfile.fd = 0; - stzalloc did it */
}
np->type = NHERE;
- heredoc = stalloc(sizeof(struct heredoc));
+ heredoc = stzalloc(sizeof(struct heredoc));
heredoc->here = np;
c = pgetc();
if (c == '-') {
heredoc->striptabs = 1;
} else {
- heredoc->striptabs = 0;
+ /*heredoc->striptabs = 0; - stzalloc did it */
pungetc();
}
break;
union node *n;
here = heredoclist;
- heredoclist = 0;
+ heredoclist = NULL;
while (here) {
if (needprompt) {