Avoid side effects in putc(), which may be implemented as a macro
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
committed by
Denys Vlasenko
parent
95d48f2598
commit
77d4872691
@@ -953,7 +953,8 @@ sharg(union node *arg, FILE *fp)
|
||||
for (p = arg->narg.text; *p; p++) {
|
||||
switch ((unsigned char)*p) {
|
||||
case CTLESC:
|
||||
putc(*++p, fp);
|
||||
p++;
|
||||
putc(*p, fp);
|
||||
break;
|
||||
case CTLVAR:
|
||||
putc('$', fp);
|
||||
@@ -962,8 +963,10 @@ sharg(union node *arg, FILE *fp)
|
||||
if (subtype == VSLENGTH)
|
||||
putc('#', fp);
|
||||
|
||||
while (*p != '=')
|
||||
putc(*p++, fp);
|
||||
while (*p != '=') {
|
||||
putc(*p, fp);
|
||||
p++;
|
||||
}
|
||||
|
||||
if (subtype & VSNUL)
|
||||
putc(':', fp);
|
||||
|
||||
Reference in New Issue
Block a user