mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 01:15:19 +00:00
python: use simpler methods
* python/libvirt-override.c (libvirt_virDomainGetVcpus) (libvirt_virDomainGetVcpuPinInfo): Use Py_XDECREF instead of open-coding it. (cherry picked from commit 8566618f65d983b31efb8efec13c25c6410b1718)
This commit is contained in:
parent
dd85b621cf
commit
a570ecd600
@ -1415,15 +1415,9 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(cpuinfo);
|
VIR_FREE(cpuinfo);
|
||||||
VIR_FREE(cpumap);
|
VIR_FREE(cpumap);
|
||||||
/* NB, Py_DECREF is a badly defined macro, so we require
|
Py_XDECREF(pyretval);
|
||||||
* braces here to avoid 'ambiguous else' warnings from
|
Py_XDECREF(pycpuinfo);
|
||||||
* the compiler.
|
Py_XDECREF(pycpumap);
|
||||||
* 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); }
|
|
||||||
return VIR_PY_NONE;
|
return VIR_PY_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1584,7 +1578,7 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(cpumaps);
|
VIR_FREE(cpumaps);
|
||||||
|
|
||||||
if (pycpumaps) { Py_DECREF(pycpumaps);}
|
Py_XDECREF(pycpumaps);
|
||||||
|
|
||||||
return VIR_PY_NONE;
|
return VIR_PY_NONE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user