From aa924ae7306f18f258c48f070c0d06215f157d0f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 10:30:05 +0100 Subject: [PATCH] error: New error_printf_unless_qmp() --- qemu-error.c | 11 +++++++++++ qemu-error.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/qemu-error.c b/qemu-error.c index a8c178b332..5d5fe3742f 100644 --- a/qemu-error.c +++ b/qemu-error.c @@ -41,6 +41,17 @@ void error_printf(const char *fmt, ...) va_end(ap); } +void error_printf_unless_qmp(const char *fmt, ...) +{ + va_list ap; + + if (!monitor_cur_is_qmp()) { + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + } +} + static Location std_loc = { .kind = LOC_NONE }; diff --git a/qemu-error.h b/qemu-error.h index 88e0b70567..e63c6ab31d 100644 --- a/qemu-error.h +++ b/qemu-error.h @@ -32,6 +32,8 @@ void loc_set_file(const char *fname, int lno); void error_vprintf(const char *fmt, va_list ap); void error_printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); +void error_printf_unless_qmp(const char *fmt, ...) + __attribute__ ((format(printf, 1, 2))); void error_print_loc(void); void error_set_progname(const char *argv0); void error_report(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));