some rather mechanical KNF, now that style(9) clarified on the status

of sizeof() as a function-like unary operator; use parenthesēs around
sizeof and return args consistently too
This commit is contained in:
tg
2009-06-08 20:06:50 +00:00
parent 548a415fa9
commit 6b2ad96bac
15 changed files with 832 additions and 832 deletions

52
syn.c
View File

@@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.35 2009/05/16 16:59:41 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.36 2009/06/08 20:06:49 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@@ -156,7 +156,7 @@ c_list(int multi)
break;
}
REJECT;
return t;
return (t);
}
static struct ioword *
@@ -191,7 +191,7 @@ synio(int cf)
if (iop->flag & IOBASH) {
char *cp;
nextiop = alloc(sizeof (*iop), ATEMP);
nextiop = alloc(sizeof(*iop), ATEMP);
nextiop->name = cp = alloc(5, ATEMP);
if (iop->unit > 9) {
@@ -233,7 +233,7 @@ get_command(int cf)
XPtrV args, vars;
struct nesting_state old_nesting;
iops = alloc((NUFILE + 1) * sizeof (struct ioword *), ATEMP);
iops = alloc((NUFILE + 1) * sizeof(struct ioword *), ATEMP);
XPinit(args, 16);
XPinit(vars, 16);
@@ -244,7 +244,7 @@ get_command(int cf)
afree(iops, ATEMP);
XPfree(args);
XPfree(vars);
return NULL; /* empty line */
return (NULL); /* empty line */
case LWORD:
case REDIR:
@@ -464,7 +464,7 @@ get_command(int cf)
t->ioact = NULL;
} else {
iops[iopn++] = NULL;
iops = aresize(iops, iopn * sizeof (struct ioword *), ATEMP);
iops = aresize(iops, iopn * sizeof(struct ioword *), ATEMP);
t->ioact = iops;
}
@@ -478,7 +478,7 @@ get_command(int cf)
XPfree(vars);
}
return t;
return (t);
}
static struct op *
@@ -501,7 +501,7 @@ dogroup(void)
syntaxerr(NULL);
list = c_list(true);
musthave(c, KEYWORD|ALIAS);
return list;
return (list);
}
static struct op *
@@ -538,7 +538,7 @@ elsepart(void)
default:
REJECT;
}
return NULL;
return (NULL);
}
static struct op *
@@ -639,20 +639,20 @@ function_body(char *name,
* be used as input), we pretend there is a colon here.
*/
t->left = newtp(TCOM);
t->left->args = alloc(2 * sizeof (char *), ATEMP);
t->left->args = alloc(2 * sizeof(char *), ATEMP);
t->left->args[0] = tv = alloc(3, ATEMP);
tv[0] = CHAR;
tv[1] = ':';
tv[2] = EOS;
t->left->args[1] = NULL;
t->left->vars = alloc(sizeof (char *), ATEMP);
t->left->vars = alloc(sizeof(char *), ATEMP);
t->left->vars[0] = NULL;
t->left->lineno = 1;
}
if (!old_func_parse)
e->flags &= ~EF_FUNC_PARSE;
return t;
return (t);
}
static char **
@@ -666,7 +666,7 @@ wordlist(void)
if ((c = token(CONTIN|KEYWORD|ALIAS)) != IN) {
if (c != ';') /* non-POSIX, but at&t ksh accepts a ; here */
REJECT;
return NULL;
return (NULL);
}
while ((c = token(0)) == LWORD)
XPput(args, yylval.cp);
@@ -674,10 +674,10 @@ wordlist(void)
syntaxerr(NULL);
if (XPsize(args) == 0) {
XPfree(args);
return NULL;
return (NULL);
} else {
XPput(args, NULL);
return (char **) XPclose(args);
return ((char **)XPclose(args));
}
}
@@ -822,7 +822,7 @@ newtp(int type)
{
struct op *t;
t = alloc(sizeof (struct op), ATEMP);
t = alloc(sizeof(struct op), ATEMP);
t->type = type;
t->u.evalflags = 0;
t->args = NULL;
@@ -841,7 +841,7 @@ compile(Source *s)
herep = heres;
source = s;
yyparse();
return outtree;
return (outtree);
}
/* This kludge exists to take care of sh/at&t ksh oddity in which
@@ -858,11 +858,11 @@ static int
assign_command(char *s)
{
if (!*s)
return 0;
return (strcmp(s, "alias") == 0) ||
return (0);
return ((strcmp(s, "alias") == 0) ||
(strcmp(s, "export") == 0) ||
(strcmp(s, "readonly") == 0) ||
(strcmp(s, "typeset") == 0);
(strcmp(s, "typeset") == 0));
}
/* Check if we are in the middle of reading an alias */
@@ -871,8 +871,8 @@ inalias(struct source *s)
{
for (; s && s->type == SALIAS; s = s->next)
if (!(s->flags & SF_ALIASEND))
return 1;
return 0;
return (1);
return (0);
}
@@ -936,7 +936,7 @@ dbtestp_isa(Test_env *te, Test_meta meta)
if (save)
XPput(*te->pos.av, save);
}
return ret;
return (ret);
}
static const char *
@@ -945,12 +945,12 @@ dbtestp_getopnd(Test_env *te, Test_op op __unused, bool do_eval __unused)
int c = tpeek(ARRAYVAR);
if (c != LWORD)
return NULL;
return (NULL);
ACCEPT;
XPput(*te->pos.av, yylval.cp);
return null;
return (null);
}
static int
@@ -958,7 +958,7 @@ dbtestp_eval(Test_env *te __unused, Test_op op __unused,
const char *opnd1 __unused, const char *opnd2 __unused,
bool do_eval __unused)
{
return 1;
return (1);
}
static void