[PATCH 01/12] qemu: Generalize PARSE macro in qemuMonitorJSONGetMigrationParams

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

 



The macro (now called PARSE_SET) is now usable for any type which needs
a *_set bool for indicating a valid value.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_monitor_json.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 05cc634d2..16554d5b2 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2679,20 +2679,23 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
 
     result = virJSONValueObjectGet(reply, "return");
 
-#define PARSE(VAR, FIELD)                                                   \
+#define PARSE_SET(API, VAR, FIELD)                                          \
     do {                                                                    \
-        if (virJSONValueObjectGetNumberInt(result, FIELD,                   \
-                                           &params->VAR) == 0)              \
+        if (API(result, FIELD, &params->VAR) == 0)                          \
             params->VAR ## _set = true;                                     \
     } while (0)
 
-    PARSE(compressLevel, "compress-level");
-    PARSE(compressThreads, "compress-threads");
-    PARSE(decompressThreads, "decompress-threads");
-    PARSE(cpuThrottleInitial, "cpu-throttle-initial");
-    PARSE(cpuThrottleIncrement, "cpu-throttle-increment");
+#define PARSE_INT(VAR, FIELD)                                               \
+    PARSE_SET(virJSONValueObjectGetNumberInt, VAR, FIELD)
 
-#undef PARSE
+    PARSE_INT(compressLevel, "compress-level");
+    PARSE_INT(compressThreads, "compress-threads");
+    PARSE_INT(decompressThreads, "decompress-threads");
+    PARSE_INT(cpuThrottleInitial, "cpu-throttle-initial");
+    PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment");
+
+#undef PARSE_SET
+#undef PARSE_INT
 
     if (virJSONValueObjectGetNumberUlong(result, "downtime-limit",
                                          &params->downtimeLimit) == 0)
-- 
2.14.3

--
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]
  Powered by Linux