Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkLhB-0003kc-HF for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:10:49 -0500 Received: from [199.232.76.173] (port=35978 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkLh9-0003jR-Po for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:10:47 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkLh4-0001PV-5i for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:10:47 -0500 Received: from mx20.gnu.org ([199.232.41.8]:5374) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NkLh3-0001Og-3U for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:10:41 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkLh1-0001IA-7o for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:10:39 -0500 Received: from blackfin.pond.sub.org (pD9E38C12.dip.t-dialin.net [217.227.140.18]) by oxygen.pond.sub.org (Postfix) with ESMTPA id BBE552DD321 for ; Wed, 24 Feb 2010 19:04:30 +0100 (CET) From: Markus Armbruster Date: Wed, 24 Feb 2010 18:55:48 +0100 Message-Id: <1267034160-3517-37-git-send-email-armbru@redhat.com> In-Reply-To: <1267034160-3517-1-git-send-email-armbru@redhat.com> References: <1267034160-3517-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH RFC 36/48] 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 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 a726d32..95e87c8 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 (!in_qmp_mon()) { + 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 75bc4bf..3ea3ba5 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 qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); -- 1.6.6