Move error_printf_unless_qmp() with monitor unit
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 20 Apr 2022 13:26:13 +0000 (17:26 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 21 Apr 2022 13:09:09 +0000 (17:09 +0400)
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 <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220420132624.2439741-31-marcandre.lureau@redhat.com>

include/monitor/monitor.h
include/qemu/error-report.h
monitor/monitor.c
stubs/error-printf.c
ui/vnc.c
util/error-report.c

index cc4cc6c6adcf61e596f68fe5135d4d2c412d3871..a4b40e8391db4de3f1c4f66106814d3a37cbc6fc 100644 (file)
@@ -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 */
index b6f45e69d79a60b481d4241b90f392651ad13321..3ae2357fda5404a552ce5fe2889a66b67c4cdfe8 100644 (file)
@@ -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);
index 21c7a68758f552cfe17cfcf7d5c946b19e112c93..86949024f643a77a6f2a253d100a33e90b9d63cc 100644 (file)
@@ -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 */
index a2f61521a16f79f1d75522d28a6967f46890d753..0e326d801059877234761e0ab7366c6a517f4230 100644 (file)
@@ -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)
 {
index 6261d922953b4825158603bdc7af07a1df7cd71d..badf1d7664fe364d32a7abdd43f447791dedad56 100644 (file)
--- 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
index 4ec7b30bcbcc70da7554cd06e330ab8b72202416..dbadaf206d2717877d69680d907742e70e043208 100644 (file)
@@ -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
 };