clean up printf
printf is avoiding switch statements so that it can be used in
very early startup, before jump tables can be read from the F segment.
We could use -fno-jump-tables, but we can also keep the if statements
and clean them up so that the indentation is fine.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/printf.c b/printf.c
index 8d7f56d..bfbd15c 100644
--- a/printf.c
+++ b/printf.c
@@ -157,18 +157,17 @@
}
morefmt:
f = *fmt++;
- do {
if (f == '%') {
addchar(&s, '%');
- break;
+ continue;
}
if (f == 'c') {
addchar(&s, va_arg(va, int));
- break;
+ continue;
}
if (f == '\0') {
--fmt;
- break;
+ continue;
}
if (f == '0') {
props.pad = '0';
@@ -196,7 +195,7 @@
panic();
break;
}
- break;
+ continue;
}
if (f == 'x') {
switch (nlong) {
@@ -210,20 +209,18 @@
panic();
break;
}
- break;
+ continue;
}
if (f == 'p') {
print_str(&s, "0x", props);
print_unsigned(&s, (unsigned long)va_arg(va, void *), 16, props);
- break;
+ continue;
}
if (f == 's') {
print_str(&s, va_arg(va, const char *), props);
- break;
+ continue;
}
addchar(&s, f);
- break;
- } while(0);
}
*s.buffer = 0;
++s.added;