From a950b083177934aebab8c1902699e5ae77033b4d Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 12 Jun 2018 07:12:15 +0200 Subject: libvirt_charPtrUnwrap: remove unnecessary check of returned string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Function libvirt_charPtrUnwrap() either fails or always sets the unwrapped string so there is no need to check it explicitly. Reviewed-by: Ján Tomko Signed-off-by: Pavel Hrdina --- libvirt-override.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'libvirt-override.c') diff --git a/libvirt-override.c b/libvirt-override.c index dac481b..2f2c4ff 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -4639,8 +4639,7 @@ libvirt_virConnectBaselineCPU(PyObject *self ATTRIBUTE_UNUSED, for (i = 0; i < ncpus; i++) { if (libvirt_charPtrUnwrap(PyList_GetItem(list, i), - &(xmlcpus[i])) < 0 || - xmlcpus[i] == NULL) { + &(xmlcpus[i])) < 0) { for (j = 0 ; j < i ; j++) VIR_FREE(xmlcpus[j]); VIR_FREE(xmlcpus); @@ -8245,8 +8244,7 @@ libvirt_virDomainFSFreeze(PyObject *self ATTRIBUTE_UNUSED, for (i = 0; i < nmountpoints; i++) { if (libvirt_charPtrUnwrap(PyList_GetItem(pyobj_list, i), - mountpoints+i) < 0 || - mountpoints[i] == NULL) + mountpoints+i) < 0) goto cleanup; } } @@ -8293,8 +8291,7 @@ libvirt_virDomainFSThaw(PyObject *self ATTRIBUTE_UNUSED, for (i = 0; i < nmountpoints; i++) { if (libvirt_charPtrUnwrap(PyList_GetItem(pyobj_list, i), - mountpoints+i) < 0 || - mountpoints[i] == NULL) + mountpoints+i) < 0) goto cleanup; } } @@ -9743,8 +9740,7 @@ libvirt_virConnectBaselineHypervisorCPU(PyObject *self ATTRIBUTE_UNUSED, for (i = 0; i < ncpus; i++) { if (libvirt_charPtrUnwrap(PyList_GetItem(list, i), - &(xmlCPUs[i])) < 0 || - !xmlCPUs[i]) + &(xmlCPUs[i])) < 0) goto cleanup; } } -- cgit v1.2.1