mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
util: use dynamic cast in error vreport
This eliminates a use of monitor_is_qmp() from the error reporting path. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20260706135824.2623960-18-berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
d32de72a73
commit
972ca7f60f
@@ -231,16 +231,15 @@ char *real_time_iso8601(void)
|
||||
G_GNUC_PRINTF(2, 0)
|
||||
static void vreport(report_type type, const char *fmt, va_list ap)
|
||||
{
|
||||
Monitor *cur = monitor_cur();
|
||||
gchar *timestr;
|
||||
|
||||
/*
|
||||
* When current monitor is QMP, messages must go to stderr
|
||||
* and have prefixes added
|
||||
* and have prefixes added, so we cast to HMP, leaving 'cur'
|
||||
* as NULL in QMP case
|
||||
*/
|
||||
if (monitor_cur_is_qmp()) {
|
||||
cur = NULL;
|
||||
}
|
||||
Monitor *cur = MONITOR(
|
||||
object_dynamic_cast(OBJECT(monitor_cur()), TYPE_MONITOR_HMP));
|
||||
gchar *timestr;
|
||||
|
||||
if (!cur) {
|
||||
qemu_flockfile(stderr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user