Skip to content

Commit

Permalink
Move error_printf_unless_qmp() with monitor unit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
elmarco committed Apr 21, 2022
1 parent a7bd942 commit 756a98d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
3 changes: 3 additions & 0 deletions include/monitor/monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 0 additions & 2 deletions include/qemu/error-report.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions stubs/error-printf.c
Original file line number Diff line number Diff line change
@@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions ui/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions util/error-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit 756a98d

Please sign in to comment.