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

[libvirt] [PATCH 03/19] qemuBuildHotpluggableCPUProps: use VIR_RETURN_PTR



This lets us get rid of the error label.

Signed-off-by: Ján Tomko <jtomko redhat com>
---
 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


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