Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh remove useless casts
details: https://anonhg.NetBSD.org/src/rev/925715b510c7
branches: trunk
changeset: 343803:925715b510c7
user: christos <christos%NetBSD.org@localhost>
date: Sat Feb 27 16:28:50 2016 +0000
description:
remove useless casts
diffstat:
bin/sh/expand.c | 14 ++++++------
bin/sh/parser.c | 62 ++++++++++++++++++++++++++++----------------------------
2 files changed, 38 insertions(+), 38 deletions(-)
diffs (truncated from 322 to 300 lines):
diff -r bad5c457bf41 -r 925715b510c7 bin/sh/expand.c
--- a/bin/sh/expand.c Sat Feb 27 16:23:22 2016 +0000
+++ b/bin/sh/expand.c Sat Feb 27 16:28:50 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expand.c,v 1.94 2016/02/22 20:02:00 christos Exp $ */
+/* $NetBSD: expand.c,v 1.95 2016/02/27 16:28:50 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
-__RCSID("$NetBSD: expand.c,v 1.94 2016/02/22 20:02:00 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.95 2016/02/27 16:28:50 christos Exp $");
#endif
#endif /* not lint */
@@ -162,7 +162,7 @@
} else {
if (flag & EXP_REDIR) /*XXX - for now, just remove escapes */
rmescapes(p);
- sp = (struct strlist *)stalloc(sizeof (struct strlist));
+ sp = stalloc(sizeof(*sp));
sp->text = p;
*exparg.lastp = sp;
exparg.lastp = &sp->next;
@@ -1002,7 +1002,7 @@
if (ifslastp == NULL) {
/* Return entire argument, IFS doesn't apply to any of it */
- sp = (struct strlist *)stalloc(sizeof *sp);
+ sp = stalloc(sizeof(*sp));
sp->text = start;
*arglist->lastp = sp;
arglist->lastp = &sp->next;
@@ -1043,7 +1043,7 @@
/* Save this argument... */
*q = '\0';
- sp = (struct strlist *)stalloc(sizeof *sp);
+ sp = stalloc(sizeof(*sp));
sp->text = start;
*arglist->lastp = sp;
arglist->lastp = &sp->next;
@@ -1077,7 +1077,7 @@
* should only generate one....
*/
if (had_param_ch || *start != 0) {
- sp = (struct strlist *)stalloc(sizeof *sp);
+ sp = stalloc(sizeof(*sp));
sp->text = start;
*arglist->lastp = sp;
arglist->lastp = &sp->next;
@@ -1300,7 +1300,7 @@
p = stalloc(strlen(name) + 1);
scopy(name, p);
- sp = (struct strlist *)stalloc(sizeof *sp);
+ sp = stalloc(sizeof(*sp));
sp->text = p;
*exparg.lastp = sp;
exparg.lastp = &sp->next;
diff -r bad5c457bf41 -r 925715b510c7 bin/sh/parser.c
--- a/bin/sh/parser.c Sat Feb 27 16:23:22 2016 +0000
+++ b/bin/sh/parser.c Sat Feb 27 16:28:50 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.c,v 1.100 2016/02/27 16:23:22 christos Exp $ */
+/* $NetBSD: parser.c,v 1.101 2016/02/27 16:28:50 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
#else
-__RCSID("$NetBSD: parser.c,v 1.100 2016/02/27 16:23:22 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.101 2016/02/27 16:28:50 christos Exp $");
#endif
#endif /* not lint */
@@ -169,7 +169,7 @@
} else if (n2->type == NREDIR) {
n2->type = NBACKGND;
} else {
- n3 = (union node *)stalloc(sizeof (struct nredir));
+ n3 = stalloc(sizeof(struct nredir));
n3->type = NBACKGND;
n3->nredir.n = n2;
n3->nredir.redirect = NULL;
@@ -180,7 +180,7 @@
n1 = n2;
}
else {
- n3 = (union node *)stalloc(sizeof (struct nbinary));
+ n3 = stalloc(sizeof(struct nbinary));
n3->type = NSEMI;
n3->nbinary.ch1 = n1;
n3->nbinary.ch2 = n2;
@@ -238,7 +238,7 @@
return n1;
}
n2 = pipeline();
- n3 = (union node *)stalloc(sizeof (struct nbinary));
+ n3 = stalloc(sizeof(struct nbinary));
n3->type = t;
n3->nbinary.ch1 = n1;
n3->nbinary.ch2 = n2;
@@ -266,15 +266,15 @@
tokpushback++;
n1 = command();
if (readtoken() == TPIPE) {
- pipenode = (union node *)stalloc(sizeof (struct npipe));
+ pipenode = stalloc(sizeof(struct npipe));
pipenode->type = NPIPE;
pipenode->npipe.backgnd = 0;
- lp = (struct nodelist *)stalloc(sizeof (struct nodelist));
+ lp = stalloc(sizeof(struct nodelist));
pipenode->npipe.cmdlist = lp;
lp->n = n1;
do {
prev = lp;
- lp = (struct nodelist *)stalloc(sizeof (struct nodelist));
+ lp = stalloc(sizeof(struct nodelist));
lp->n = command();
prev->next = lp;
} while (readtoken() == TPIPE);
@@ -284,7 +284,7 @@
tokpushback++;
if (negate) {
TRACE(("negate pipeline\n"));
- n2 = (union node *)stalloc(sizeof (struct nnot));
+ n2 = stalloc(sizeof(struct nnot));
n2->type = NNOT;
n2->nnot.com = n1;
return n2;
@@ -326,7 +326,7 @@
switch (readtoken()) {
case TIF:
- n1 = (union node *)stalloc(sizeof (struct nif));
+ n1 = stalloc(sizeof(struct nif));
n1->type = NIF;
n1->nif.test = list(0, 0);
if (readtoken() != TTHEN)
@@ -334,7 +334,7 @@
n1->nif.ifpart = list(0, 0);
n2 = n1;
while (readtoken() == TELIF) {
- n2->nif.elsepart = (union node *)stalloc(sizeof (struct nif));
+ n2->nif.elsepart = stalloc(sizeof(struct nif));
n2 = n2->nif.elsepart;
n2->type = NIF;
n2->nif.test = list(0, 0);
@@ -355,7 +355,7 @@
case TWHILE:
case TUNTIL: {
int got;
- n1 = (union node *)stalloc(sizeof (struct nbinary));
+ n1 = stalloc(sizeof(struct nbinary));
n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL;
n1->nbinary.ch1 = list(0, 0);
if ((got=readtoken()) != TDO) {
@@ -371,13 +371,13 @@
case TFOR:
if (readtoken() != TWORD || quoteflag || ! goodname(wordtext))
synerror("Bad for loop variable");
- n1 = (union node *)stalloc(sizeof (struct nfor));
+ n1 = stalloc(sizeof(struct nfor));
n1->type = NFOR;
n1->nfor.var = wordtext;
if (readtoken() == TWORD && ! quoteflag && equal(wordtext, "in")) {
app = ≈
while (readtoken() == TWORD) {
- n2 = (union node *)stalloc(sizeof (struct narg));
+ n2 = stalloc(sizeof(struct narg));
n2->type = NARG;
n2->narg.text = wordtext;
n2->narg.backquote = backquotelist;
@@ -392,7 +392,7 @@
static char argvars[5] = {
CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0'
};
- n2 = (union node *)stalloc(sizeof (struct narg));
+ n2 = stalloc(sizeof(struct narg));
n2->type = NARG;
n2->narg.text = argvars;
n2->narg.backquote = NULL;
@@ -418,11 +418,11 @@
checkkwd = 1;
break;
case TCASE:
- n1 = (union node *)stalloc(sizeof (struct ncase));
+ n1 = stalloc(sizeof(struct ncase));
n1->type = NCASE;
if (readtoken() != TWORD)
synexpect(TWORD);
- n1->ncase.expr = n2 = (union node *)stalloc(sizeof (struct narg));
+ n1->ncase.expr = n2 = stalloc(sizeof(struct narg));
n2->type = NARG;
n2->narg.text = wordtext;
n2->narg.backquote = backquotelist;
@@ -444,13 +444,13 @@
* case option.
*/
while (lasttoken != TESAC) {
- *cpp = cp = (union node *)stalloc(sizeof (struct nclist));
+ *cpp = cp = stalloc(sizeof(struct nclist));
if (lasttoken == TLP)
readtoken();
cp->type = NCLIST;
app = &cp->nclist.pattern;
for (;;) {
- *app = ap = (union node *)stalloc(sizeof (struct narg));
+ *app = ap = stalloc(sizeof(struct narg));
ap->type = NARG;
ap->narg.text = wordtext;
ap->narg.backquote = backquotelist;
@@ -484,7 +484,7 @@
checkkwd = 1;
break;
case TLP:
- n1 = (union node *)stalloc(sizeof (struct nredir));
+ n1 = stalloc(sizeof(struct nredir));
n1->type = NSUBSHELL;
n1->nredir.n = list(0, 0);
n1->nredir.redirect = NULL;
@@ -536,7 +536,7 @@
*rpp = NULL;
if (redir) {
if (n1->type != NSUBSHELL) {
- n2 = (union node *)stalloc(sizeof (struct nredir));
+ n2 = stalloc(sizeof(struct nredir));
n2->type = NREDIR;
n2->nredir.n = n1;
n1 = n2;
@@ -547,7 +547,7 @@
checkneg:
if (negate) {
TRACE(("negate command\n"));
- n2 = (union node *)stalloc(sizeof (struct nnot));
+ n2 = stalloc(sizeof(struct nnot));
n2->type = NNOT;
n2->nnot.com = n1;
return n2;
@@ -587,7 +587,7 @@
for (;;) {
if (readtoken() == TWORD) {
- n = (union node *)stalloc(sizeof (struct narg));
+ n = stalloc(sizeof(struct narg));
n->type = NARG;
n->narg.text = wordtext;
n->narg.backquote = backquotelist;
@@ -617,7 +617,7 @@
}
*app = NULL;
*rpp = NULL;
- n = (union node *)stalloc(sizeof (struct ncmd));
+ n = stalloc(sizeof(struct ncmd));
n->type = NCMD;
n->ncmd.backgnd = 0;
n->ncmd.args = args;
@@ -626,7 +626,7 @@
checkneg:
if (negate) {
TRACE(("negate simplecmd\n"));
- n2 = (union node *)stalloc(sizeof (struct nnot));
+ n2 = stalloc(sizeof(struct nnot));
n2->type = NNOT;
n2->nnot.com = n;
return n2;
@@ -640,7 +640,7 @@
{
union node *n;
- n = (union node *)stalloc(sizeof (struct narg));
+ n = stalloc(sizeof(struct narg));
n->type = NARG;
n->narg.next = NULL;
n->narg.text = wordtext;
@@ -730,7 +730,7 @@
continue;
readtoken1(c, here->here->type == NHERE? SQSYNTAX : DQSYNTAX,
here->eofmark, here->striptabs);
- n = (union node *)stalloc(sizeof (struct narg));
+ n = stalloc(sizeof(struct narg));
n->narg.type = NARG;
n->narg.next = NULL;
n->narg.text = wordtext;
@@ -1357,7 +1357,7 @@
union node *np;
strlcpy(fd, out, sizeof(fd));
- np = (union node *)stalloc(sizeof (struct nfile));
+ np = stalloc(sizeof(struct nfile));
if (c == '>') {
np->nfile.fd = 1;
c = pgetc();
@@ -1376,11 +1376,11 @@
Home |
Main Index |
Thread Index |
Old Index