[PATCH 3/5] monitor: rework monitor_cur_is_qmp() into monitor_cur_is_hmp()

Vladimir Sementsov-Ogievskiy posted 5 patches 1 day, 16 hours ago
Maintainers: Markus Armbruster <armbru@redhat.com>, "Dr. David Alan Gilbert" <dave@treblig.org>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
[PATCH 3/5] monitor: rework monitor_cur_is_qmp() into monitor_cur_is_hmp()
Posted by Vladimir Sementsov-Ogievskiy 1 day, 16 hours ago
Condition in error_vprintf() becomes simpler. Also we are going
to reuse monitor_cur_is_hmp() in the following commit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 include/monitor/monitor.h | 2 +-
 monitor/monitor.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 296690e1f1..b531108eeb 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -15,7 +15,7 @@ extern QemuOptsList qemu_mon_opts;
 
 Monitor *monitor_cur(void);
 Monitor *monitor_set_cur(Coroutine *co, Monitor *mon);
-bool monitor_cur_is_qmp(void);
+bool monitor_cur_is_hmp(void);
 
 void monitor_init_globals(void);
 void monitor_init_globals_core(void);
diff --git a/monitor/monitor.c b/monitor/monitor.c
index b5007c1851..8ca17e9326 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -109,11 +109,11 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
 /**
  * Is the current monitor, if any, a QMP monitor?
  */
-bool monitor_cur_is_qmp(void)
+bool monitor_cur_is_hmp(void)
 {
     Monitor *cur_mon = monitor_cur();
 
-    return cur_mon && monitor_is_qmp(cur_mon);
+    return cur_mon && !monitor_is_qmp(cur_mon);
 }
 
 /**
@@ -275,7 +275,7 @@ int error_vprintf(const char *fmt, va_list ap)
 {
     Monitor *cur_mon = monitor_cur();
 
-    if (cur_mon && !monitor_cur_is_qmp()) {
+    if (monitor_cur_is_hmp()) {
         return monitor_vprintf(cur_mon, fmt, ap);
     }
     return vfprintf(stderr, fmt, ap);
-- 
2.48.1