summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-06-11 14:32:47 -0600
committerEric Blake <eblake@redhat.com>2012-06-12 06:37:59 -0600
commit1049fdb7f83a7813f424a039fc411aa7acdb4c7f (patch)
tree37fdb49490c52938b31a87d739912e1d8d696b38
parent2f04eb3b4791df014b6ce7f2671318a52b306588 (diff)
downloadlibvirt-python-split-1049fdb7f83a7813f424a039fc411aa7acdb4c7f.zip
libvirt-python-split-1049fdb7f83a7813f424a039fc411aa7acdb4c7f.tar.gz
libvirt-python-split-1049fdb7f83a7813f424a039fc411aa7acdb4c7f.tar.xz
python: use simpler methods
* python/libvirt-override.c (libvirt_virDomainGetVcpus) (libvirt_virDomainGetVcpuPinInfo): Use Py_XDECREF instead of open-coding it.
-rw-r--r--libvirt-override.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index 130e702..da5cb9a 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1415,15 +1415,9 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
cleanup:
VIR_FREE(cpuinfo);
VIR_FREE(cpumap);
- /* NB, Py_DECREF is a badly defined macro, so we require
- * braces here to avoid 'ambiguous else' warnings from
- * the compiler.
- * NB. this comment is true at of time of writing wrt to
- * at least python2.5.
- */
- if (pyretval) { Py_DECREF(pyretval); }
- if (pycpuinfo) { Py_DECREF(pycpuinfo); }
- if (pycpumap) { Py_DECREF(pycpumap); }
+ Py_XDECREF(pyretval);
+ Py_XDECREF(pycpuinfo);
+ Py_XDECREF(pycpumap);
return VIR_PY_NONE;
}
@@ -1584,7 +1578,7 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self ATTRIBUTE_UNUSED,
cleanup:
VIR_FREE(cpumaps);
- if (pycpumaps) { Py_DECREF(pycpumaps);}
+ Py_XDECREF(pycpumaps);
return VIR_PY_NONE;
}