mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-29 05:13:54 -06:00
qemu-error: remove dependency of stubs on monitor
Leave the implementation of error_vprintf and error_vprintf_unless_qmp (the latter now trivially wrapped by error_printf_unless_qmp) to libqemustub.a and monitor.c. This has two advantages: it lets us remove the monitor_printf and monitor_vprintf stubs, and it lets tests provide a different implementation of the functions that uses g_test_message. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1477326663-67817-2-git-send-email-pbonzini@redhat.com>
This commit is contained in:
parent
9bc9732fae
commit
397d30e940
6 changed files with 39 additions and 35 deletions
|
@ -14,24 +14,6 @@
|
|||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
/*
|
||||
* Print to current monitor if we have one, else to stderr.
|
||||
* TODO should return int, so callers can calculate width, but that
|
||||
* requires surgery to monitor_vprintf(). Left for another day.
|
||||
*/
|
||||
void error_vprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
if (cur_mon && !monitor_cur_is_qmp()) {
|
||||
monitor_vprintf(cur_mon, fmt, ap);
|
||||
} else {
|
||||
vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print to current monitor if we have one, else to stderr.
|
||||
* TODO just like error_vprintf()
|
||||
*/
|
||||
void error_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -45,11 +27,9 @@ 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);
|
||||
}
|
||||
va_start(ap, fmt);
|
||||
error_vprintf_unless_qmp(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static Location std_loc = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue