Message ID | 1265290180-31243-1-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
On Thursday 04 February 2010 21:29:40 Paolo Bonzini wrote: > Other choices include using "(printf)", but this one is not bad in > terms of readability. This works well. :) Acked-by: Sheng Yang <sheng@linux.intel.com> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> And there is two more... One is: readline.c:31:1: error: "printf" redefined In file included from /usr/include/stdio.h:844, from qemu-common.h:21, from readline.h:4, from readline.c:24: /usr/include/bits/stdio2.h:65:1: error: this is the location of the previous definition make: *** [readline.o] Error 1 Of course, what you can see in readline.c is: #define printf do_not_use_printf I guess it's OK to remove this? And there is last one in help() of vl.c... After resolve these three, the build is fine now. Paolo, could you address the other two issues as well in your patch? Thanks!
Patch 1 is the same I sent earlier. Patches 2 and 3/4 fix the other two problems by Sheng (tip: next time use "make -k" and report all problems in a single message). Paolo Bonzini (4): qemu-img: avoid preprocessor directives in a printf call cope with printf macro definition in readline.c do not interpolate % from vl.c to qemu-options.h vl.c: avoid preprocessor directives in a printf call qemu-img.c | 9 +++++---- qemu-options.hx | 15 ++++++++------- readline.c | 1 + vl.c | 23 +++++++++-------------- 4 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c index cbba4fc..eb5c0f0 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -58,7 +58,8 @@ static void format_print(void *opaque, const char *name) /* Please keep in synch with qemu-img.texi */ static void help(void) { - printf("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 Fabrice Bellard\n" + const char *help_msg = + "qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 Fabrice Bellard\n" "usage: qemu-img command [command options]\n" "QEMU disk image utility\n" "\n" @@ -91,9 +92,9 @@ static void help(void) " '-a' applies a snapshot (revert disk to saved state)\n" " '-c' creates a snapshot\n" " '-d' deletes a snapshot\n" - " '-l' lists all snapshots in the given image\n" - ); - printf("\nSupported formats:"); + " '-l' lists all snapshots in the given image\n"; + + printf("%s\nSupported formats:", help_msg); bdrv_iterate_format(format_print, NULL); printf("\n"); exit(1);
Other choices include using "(printf)", but this one is not bad in terms of readability. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- qemu-img.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)