goto keeps us from evaluating the loop condition twice in immediate succession
(and shaves off an indentation level)
This commit is contained in:
parent
1c07e75fc0
commit
d4b81df050
20
funcs.c
20
funcs.c
|
@ -38,7 +38,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.309 2016/11/11 19:02:26 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.310 2016/11/11 19:09:44 tg Exp $");
|
||||
|
||||
#if HAVE_KILLPG
|
||||
/*
|
||||
|
@ -433,14 +433,15 @@ c_print(const char **wp)
|
|||
|
||||
Xinit(xs, xp, 128, ATEMP);
|
||||
|
||||
while (*wp != NULL) {
|
||||
if (*wp == NULL)
|
||||
goto print_no_arg;
|
||||
print_read_arg:
|
||||
if (po.chars) {
|
||||
while (*wp != NULL) {
|
||||
s = *wp++;
|
||||
if (*s == '\0')
|
||||
break;
|
||||
if (!evaluate(s, &po.wc,
|
||||
KSH_RETURN_ERROR, true))
|
||||
if (!evaluate(s, &po.wc, KSH_RETURN_ERROR, true))
|
||||
return (1);
|
||||
Xcheck(xs, xp);
|
||||
if (UTFMODE) {
|
||||
|
@ -461,7 +462,7 @@ c_print(const char **wp)
|
|||
c = unbksl(false, s_get, s_put);
|
||||
s = s_ptr;
|
||||
if (c == -1) {
|
||||
/* rejected by generic unbksl */
|
||||
/* rejected by generic function */
|
||||
switch ((c = *s++)) {
|
||||
case 'c':
|
||||
po.nl = false;
|
||||
|
@ -475,9 +476,8 @@ c_print(const char **wp)
|
|||
Xput(xs, xp, '\\');
|
||||
}
|
||||
} else if ((unsigned int)c > 0xFF) {
|
||||
/* unbksl returned Unicode */
|
||||
po.ts[utf_wctomb(po.ts,
|
||||
c - 0x100)] = 0;
|
||||
/* generic function returned Unicode */
|
||||
po.ts[utf_wctomb(po.ts, c - 0x100)] = 0;
|
||||
c = 0;
|
||||
do {
|
||||
Xput(xs, xp, po.ts[c]);
|
||||
|
@ -488,9 +488,11 @@ c_print(const char **wp)
|
|||
Xput(xs, xp, c);
|
||||
}
|
||||
}
|
||||
if (*wp != NULL)
|
||||
if (*wp != NULL) {
|
||||
Xput(xs, xp, ' ');
|
||||
goto print_read_arg;
|
||||
}
|
||||
print_no_arg:
|
||||
if (po.nl)
|
||||
Xput(xs, xp, '\n');
|
||||
|
||||
|
|
Loading…
Reference in New Issue