[PATCH 03/19] qemuBuildHotpluggableCPUProps: use VIR_RETURN_PTR

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

 



This lets us get rid of the error label.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1b5cde6ec7..5e05916b23 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11047,33 +11047,29 @@ virJSONValuePtr
 qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
 {
     qemuDomainVcpuPrivatePtr vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
-    virJSONValuePtr ret = NULL;
+    VIR_AUTOPTR(virJSONValue) ret = NULL;
 
     if (virJSONValueObjectCreate(&ret, "s:driver", vcpupriv->type,
                                        "s:id", vcpupriv->alias, NULL) < 0)
-        goto error;
+        return NULL;
 
     if (vcpupriv->socket_id != -1 &&
         virJSONValueObjectAdd(ret, "i:socket-id", vcpupriv->socket_id, NULL) < 0)
-        goto error;
+        return NULL;
 
     if (vcpupriv->core_id != -1 &&
         virJSONValueObjectAdd(ret, "i:core-id", vcpupriv->core_id, NULL) < 0)
-        goto error;
+        return NULL;
 
     if (vcpupriv->thread_id != -1 &&
         virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL) < 0)
-        goto error;
+        return NULL;
 
     if (vcpupriv->node_id != -1 &&
         virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) < 0)
-        goto error;
-
-    return ret;
+        return NULL;
 
- error:
-    virJSONValueFree(ret);
-    return NULL;
+    VIR_RETURN_PTR(ret);
 }
 
 
-- 
2.19.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