[PATCH 7/9] util: qemu: Don't access virJSONValue members directly in virQEMUBuildCommandLineJSONRecurse

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

 



Use the accessors instead.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virqemu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index e7ea068b94..d6652262fe 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -148,6 +148,7 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
     struct virQEMUCommandLineJSONIteratorData data = { key, buf, arrayFunc };
     virJSONType type = virJSONValueGetType(value);
     virJSONValuePtr elem;
+    bool tmp;
     size_t i;

     if (!key && type != VIR_JSON_TYPE_OBJECT) {
@@ -159,16 +160,17 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
     switch (type) {
     case VIR_JSON_TYPE_STRING:
         virBufferAsprintf(buf, "%s=", key);
-        virQEMUBuildBufferEscapeComma(buf, value->data.string);
+        virQEMUBuildBufferEscapeComma(buf, virJSONValueGetString(value));
         virBufferAddLit(buf, ",");
         break;

     case VIR_JSON_TYPE_NUMBER:
-        virBufferAsprintf(buf, "%s=%s,", key, value->data.number);
+        virBufferAsprintf(buf, "%s=%s,", key, virJSONValueGetNumberString(value));
         break;

     case VIR_JSON_TYPE_BOOLEAN:
-        if (value->data.boolean)
+        virJSONValueGetBoolean(value, &tmp);
+        if (tmp)
             virBufferAsprintf(buf, "%s=yes,", key);
         else
             virBufferAsprintf(buf, "%s=no,", key);
-- 
2.16.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]

  Powered by Linux