From 1d39dbaf637db03f6e597ed56b96aa065710b4a1 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Mon, 5 Oct 2015 09:42:23 +0200 Subject: use VYR_PY_LIST_SET_GOTO and VIR_PY_LIST_APPEND_GOTO Signed-off-by: Pavel Hrdina --- libvirt-lxc-override.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'libvirt-lxc-override.c') diff --git a/libvirt-lxc-override.c b/libvirt-lxc-override.c index b0550c7..316a500 100644 --- a/libvirt-lxc-override.c +++ b/libvirt-lxc-override.c @@ -82,17 +82,8 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED, if ((py_retval = PyList_New(0)) == NULL) goto error; - for (i = 0; i < c_retval; i++) { - PyObject *item = NULL; - - if ((item = libvirt_intWrap(fdlist[i])) == NULL) - goto error; - - if (PyList_Append(py_retval, item) < 0) { - Py_DECREF(item); - goto error; - } - } + for (i = 0; i < c_retval; i++) + VIR_PY_LIST_APPEND_GOTO(py_retval, libvirt_intWrap(fdlist[1]), error); cleanup: VIR_FREE(fdlist); -- cgit v1.2.1