[libvirt PATCH 01/14] qemu: agent: remove redundant checks

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

 



virJSONValueObjectGetArray returns NULL if the object with
the supplied key is not an array.

Calling virJSONValueIsArray right after is redundant.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_agent.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 09116e749c..456f0b69e6 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1444,12 +1444,6 @@ qemuAgentGetVCPUs(qemuAgentPtr agent,
         goto cleanup;
     }
 
-    if (!virJSONValueIsArray(data)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Malformed guest-get-vcpus data array"));
-        goto cleanup;
-    }
-
     ndata = virJSONValueArraySize(data);
 
     *info = g_new0(qemuAgentCPUInfo, ndata);
@@ -2314,12 +2308,6 @@ qemuAgentGetUsers(qemuAgentPtr agent,
         return -1;
     }
 
-    if (!virJSONValueIsArray(data)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Malformed guest-get-users data array"));
-        return -1;
-    }
-
     ndata = virJSONValueArraySize(data);
 
     if (virTypedParamsAddUInt(params, nparams, maxparams,
-- 
2.26.2




[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