From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NnDXW-0005gS-AN for qemu-devel@nongnu.org; Thu, 04 Mar 2010 11:04:42 -0500 Received: from [199.232.76.173] (port=58584 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NnDXV-0005gD-TO for qemu-devel@nongnu.org; Thu, 04 Mar 2010 11:04:41 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NnDXM-0001PN-W7 for qemu-devel@nongnu.org; Thu, 04 Mar 2010 11:04:41 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]:47481) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NnDXM-0001Of-Hq for qemu-devel@nongnu.org; Thu, 04 Mar 2010 11:04:32 -0500 Received: from blackfin.pond.sub.org (pD9E38041.dip.t-dialin.net [217.227.128.65]) by oxygen.pond.sub.org (Postfix) with ESMTPA id EC400276D6B for ; Thu, 4 Mar 2010 17:04:29 +0100 (CET) From: Markus Armbruster Date: Thu, 4 Mar 2010 16:56:59 +0100 Message-Id: <1267718231-13303-39-git-send-email-armbru@redhat.com> In-Reply-To: <1267718231-13303-1-git-send-email-armbru@redhat.com> References: <1267718231-13303-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 38/50] error: New error_printf_unless_qmp() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Luiz Capitulino Signed-off-by: Markus Armbruster --- qemu-error.c | 11 +++++++++++ qemu-error.h | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/qemu-error.c b/qemu-error.c index a8c178b..5d5fe37 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 88e0b70..e63c6ab 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))); -- 1.6.6.1