diff mbox series

[v5,05/15] tests/tcg/minilib: support %c format char

Message ID 20190430165234.32272-6-alex.bennee@linaro.org
State New
Headers show
Series demacro softmmu (plus tests/coverage) | expand

Commit Message

Alex Bennée April 30, 2019, 4:52 p.m. UTC
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/tcg/minilib/printf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.20.1

Comments

Richard Henderson May 1, 2019, 2:40 p.m. UTC | #1
On 4/30/19 9:52 AM, Alex Bennée wrote:
> @@ -119,6 +119,10 @@ void ml_printf(const char *fmt, ...)

>              str = va_arg(ap, char*);

>              print_str(str);

>              break;

> +        case 'c':

> +            c = (char) va_arg(ap, int);

> +            __sys_outc(c);

> +            break;


The assignment and cast are both unnecessary.
You could just as well write

    __sys_outc(va_arg(ap, int))

but it's not wrong so

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
diff mbox series

Patch

diff --git a/tests/tcg/minilib/printf.c b/tests/tcg/minilib/printf.c
index 121620cb16..d530b32be5 100644
--- a/tests/tcg/minilib/printf.c
+++ b/tests/tcg/minilib/printf.c
@@ -47,7 +47,7 @@  static void print_num(unsigned long long value, int base)
 void ml_printf(const char *fmt, ...)
 {
     va_list ap;
-    char *str;
+    char *str, c;
     int base;
     int has_long;
     int alt_form;
@@ -119,6 +119,10 @@  void ml_printf(const char *fmt, ...)
             str = va_arg(ap, char*);
             print_str(str);
             break;
+        case 'c':
+            c = (char) va_arg(ap, int);
+            __sys_outc(c);
+            break;
         case '%':
             __sys_outc(*fmt);
             break;