[PATCH 03/10] qemu: monitor: Add do-while block to QEMU_CHECK_MONITOR_FULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Assure that it's just one statement to avoid problems when used with
conditions.
---
 src/qemu/qemu_monitor.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b58c412..1ef18dd 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -112,17 +112,20 @@ struct _qemuMonitor {
  * monitor.
  */
 #define QEMU_CHECK_MONITOR_FULL(mon, force_json, exit)                         \
-    if (!mon) {                                                                \
-        virReportError(VIR_ERR_INVALID_ARG, "%s",                              \
-                       _("monitor must not be NULL"));                         \
-        exit;                                                                  \
-    }                                                                          \
-    VIR_DEBUG("mon:%p vm:%p json:%d fd:%d", mon, mon->vm, mon->json, mon->fd); \
-    if (force_json && !mon->json) {                                            \
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",                    \
-                       _("JSON monitor is required"));                         \
-        exit;                                                                  \
-    }
+    do {                                                                       \
+        if (!mon) {                                                            \
+            virReportError(VIR_ERR_INVALID_ARG, "%s",                          \
+                           _("monitor must not be NULL"));                     \
+            exit;                                                              \
+        }                                                                      \
+        VIR_DEBUG("mon:%p vm:%p json:%d fd:%d",                                \
+                  mon, mon->vm, mon->json, mon->fd);                           \
+        if (force_json && !mon->json) {                                        \
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",                \
+                           _("JSON monitor is required"));                     \
+            exit;                                                              \
+        }                                                                      \
+    } while (0)

 /* Check monitor and return NULL on error */
 #define QEMU_CHECK_MONITOR_NULL(mon) \
-- 
2.9.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]