Patchwork [2/3] vl.c: Fold constant string into printf rather than using %s

login
register
mail settings
Submitter Michael Ellerman
Date Dec. 12, 2011, 8:21 a.m.
Message ID <1323678104-30133-2-git-send-email-michael@ellerman.id.au>
Download mbox | patch
Permalink /patch/130670/
State New
Headers show

Comments

Michael Ellerman - Dec. 12, 2011, 8:21 a.m.
In help() we do what boils down to:

  printf("%s", "qemu");

This seems to be an artifact of be995c27640a82c7056b6f53d02ec823570114e5
("removed unused code"), which removed some ifdef'ery that used to print
a different name depending on CONFIG_SOFTMMU.

But now that is gone and we always use "qemu" we may as well just put
that in the format string.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 vl.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Andreas Färber - Dec. 12, 2011, 9:40 a.m.
Am 12.12.2011 09:21, schrieb Michael Ellerman:
> In help() we do what boils down to:
> 
>   printf("%s", "qemu");
> 
> This seems to be an artifact of be995c27640a82c7056b6f53d02ec823570114e5
> ("removed unused code"), which removed some ifdef'ery that used to print
> a different name depending on CONFIG_SOFTMMU.
> 
> But now that is gone and we always use "qemu" we may as well just put
> that in the format string.

I would rather propose to save argv[0] and use that. By now "qemu" is
not even correct for i386.

Andreas

Patch

diff --git a/vl.c b/vl.c
index 6a2ca6f..b492f8c 100644
--- a/vl.c
+++ b/vl.c
@@ -1502,7 +1502,7 @@  static void help(int exitcode)
 #undef GEN_DOCS
         ;
     version();
-    printf("usage: %s [options] [disk_image]\n"
+    printf("usage: qemu [options] [disk_image]\n"
            "\n"
            "'disk_image' is a raw hard disk image for IDE hard disk 0\n"
            "\n"
@@ -1513,7 +1513,6 @@  static void help(int exitcode)
            "ctrl-alt        toggle mouse and keyboard grab\n"
            "\n"
            "When using -nographic, press 'ctrl-a h' to get some help.\n",
-           "qemu",
            options_help);
     exit(exitcode);
 }