From 756a98dd701ec3a9127c700ba9e7e93254b05f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 20 Apr 2022 17:26:13 +0400 Subject: [PATCH] Move error_printf_unless_qmp() with monitor unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it depends on monitor code, and error_vprintf_unless_qmp() is already there. This will help to move error-report in a common subproject. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id: <20220420132624.2439741-31-marcandre.lureau@redhat.com> --- include/monitor/monitor.h | 3 +++ include/qemu/error-report.h | 2 -- monitor/monitor.c | 10 ++++++++++ stubs/error-printf.c | 1 + ui/vnc.c | 1 + util/error-report.c | 11 ----------- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index cc4cc6c6ad..a4b40e8391 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -56,4 +56,7 @@ void monitor_register_hmp(const char *name, bool info, void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **errp)); +int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); +int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2); + #endif /* MONITOR_H */ diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index b6f45e69d7..3ae2357fda 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -32,8 +32,6 @@ void loc_set_file(const char *fname, int lno); int error_vprintf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); int error_printf(const char *fmt, ...) G_GNUC_PRINTF(1, 2); -int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); -int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2); void error_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); void warn_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); diff --git a/monitor/monitor.c b/monitor/monitor.c index 21c7a68758..86949024f6 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -286,6 +286,16 @@ int error_vprintf_unless_qmp(const char *fmt, va_list ap) return -1; } +int error_printf_unless_qmp(const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = error_vprintf_unless_qmp(fmt, ap); + va_end(ap); + return ret; +} static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = { /* Limit guest-triggerable events to 1 per second */ diff --git a/stubs/error-printf.c b/stubs/error-printf.c index a2f61521a1..0e326d8010 100644 --- a/stubs/error-printf.c +++ b/stubs/error-printf.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "monitor/monitor.h" int error_vprintf(const char *fmt, va_list ap) { diff --git a/ui/vnc.c b/ui/vnc.c index 6261d92295..badf1d7664 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -54,6 +54,7 @@ #include "qemu/cutils.h" #include "qemu/help_option.h" #include "io/dns-resolver.h" +#include "monitor/monitor.h" #define VNC_REFRESH_INTERVAL_BASE GUI_REFRESH_INTERVAL_DEFAULT #define VNC_REFRESH_INTERVAL_INC 50 diff --git a/util/error-report.c b/util/error-report.c index 4ec7b30bcb..dbadaf206d 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -40,17 +40,6 @@ int error_printf(const char *fmt, ...) return ret; } -int error_printf_unless_qmp(const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = error_vprintf_unless_qmp(fmt, ap); - va_end(ap); - return ret; -} - static Location std_loc = { .kind = LOC_NONE };