summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-08-30 20:13:33 +0000
committerjilles <jilles@FreeBSD.org>2013-08-30 20:13:33 +0000
commit67c1af28578426f0278f38d28d01be27682f8bf3 (patch)
tree9d2aa5ded8f3ea127333c96cb0cbb6f440f7432b /bin/sh
parent36259bf9a23d3108e0dea9e6ed15c10d82e62497 (diff)
downloadFreeBSD-src-67c1af28578426f0278f38d28d01be27682f8bf3.zip
FreeBSD-src-67c1af28578426f0278f38d28d01be27682f8bf3.tar.gz
sh: Use makename() where possible.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/parser.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 4bf869e..db7db37 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -457,10 +457,7 @@ command(void)
if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) {
app = &ap;
while (readtoken() == TWORD) {
- n2 = (union node *)stalloc(sizeof (struct narg));
- n2->type = NARG;
- n2->narg.text = wordtext;
- n2->narg.backquote = backquotelist;
+ n2 = makename();
*app = n2;
app = &n2->narg.next;
}
@@ -500,11 +497,7 @@ command(void)
n1 = (union node *)stalloc(sizeof (struct ncase));
n1->type = NCASE;
consumetoken(TWORD);
- n1->ncase.expr = n2 = (union node *)stalloc(sizeof (struct narg));
- n2->type = NARG;
- n2->narg.text = wordtext;
- n2->narg.backquote = backquotelist;
- n2->narg.next = NULL;
+ n1->ncase.expr = makename();
while (readtoken() == TNL);
if (lasttoken != TWORD || ! equal(wordtext, "in"))
synerror("expecting \"in\"");
@@ -517,10 +510,7 @@ command(void)
if (lasttoken == TLP)
readtoken();
for (;;) {
- *app = ap = (union node *)stalloc(sizeof (struct narg));
- ap->type = NARG;
- ap->narg.text = wordtext;
- ap->narg.backquote = backquotelist;
+ *app = ap = makename();
checkkwd = CHKNL | CHKKWD;
if (readtoken() != TPIPE)
break;
@@ -632,10 +622,7 @@ simplecmd(union node **rpp, union node *redir)
for (;;) {
checkkwd = savecheckkwd;
if (readtoken() == TWORD) {
- n = (union node *)stalloc(sizeof (struct narg));
- n->type = NARG;
- n->narg.text = wordtext;
- n->narg.backquote = backquotelist;
+ n = makename();
*app = n;
app = &n->narg.next;
if (savecheckkwd != 0 && !isassignment(wordtext))
@@ -772,11 +759,7 @@ parseheredoc(void)
}
readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX,
here->eofmark, here->striptabs);
- n = (union node *)stalloc(sizeof (struct narg));
- n->narg.type = NARG;
- n->narg.next = NULL;
- n->narg.text = wordtext;
- n->narg.backquote = backquotelist;
+ n = makename();
here->here->nhere.doc = n;
}
}
OpenPOWER on IntegriCloud