Most of the code treats libvirt API calls as separate block, keeping one
blank line before the LIBVIRT_BEGIN_ALLOW_THREAD, and one blank line
after LIBVIRT_END_ALLOW_THREADS. Unify the whitespace so all calls
wrapped with these macros are treated as a separate block.
---
libvirt-override.c | 115 -
1 file changed, 87 insertions(+), 28 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index f5ff605..d746350 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -441,6 +441,7 @@ libvirt_virDomainGetSchedulerType(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetSchedulerType(domain, &nparams);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval == NULL)
return VIR_PY_NONE;
@@ -1221,6 +1222,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
i_retval = virDomainGetInfo(domain, &dominfo);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0)
return VIR_PY_NONE;
@@ -1239,6 +1241,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
cpuinfo, dominfo.nrVirtCpu,
cpumap, cpumaplen);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0) {
error = VIR_PY_NONE;
goto cleanup;
@@ -1402,6 +1405,7 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
i_retval = virDomainGetInfo(domain, &dominfo);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0)
return VIR_PY_NONE;
@@ -1522,6 +1526,7 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
ret = virDomainGetEmulatorPinInfo(domain, cpumap, cpumaplen, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (ret < 0) {
VIR_FREE(cpumap);
return VIR_PY_NONE;
@@ -1660,6 +1665,7 @@ libvirt_virDomainPinIOThread(PyObject *self
ATTRIBUTE_UNUSED,
i_retval = virDomainPinIOThread(domain, iothread_val,
cpumap, cpumaplen, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0) {
ret = VIR_PY_INT_FAIL;
goto cleanup;
@@ -1728,6 +1734,7 @@ libvirt_virConnGetLastError(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
err = virConnGetLastError(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (err == NULL)
return VIR_PY_NONE;
@@ -1970,9 +1977,9 @@ libvirt_virConnectOpenAuth(PyObject *self
ATTRIBUTE_UNUSED,
auth.cbdata = pyauth;
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectOpenAuth(name, &auth, flags);
LIBVIRT_END_ALLOW_THREADS;
+
VIR_FREE(auth.credtype);
py_retval = libvirt_virConnectPtrWrap((virConnectPtr) c_retval);
return py_retval;
@@ -1997,12 +2004,10 @@ libvirt_virGetVersion(PyObject *self ATTRIBUTE_UNUSED,
return NULL;
LIBVIRT_BEGIN_ALLOW_THREADS;
-
if (type == NULL)
c_retval = virGetVersion(&libVer, NULL, NULL);
else
c_retval = virGetVersion(&libVer, type, &typeVer);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2029,9 +2034,7 @@ libvirt_virConnectGetVersion(PyObject *self
ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectGetVersion(conn, &hvVersion);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2059,9 +2062,7 @@ libvirt_virConnectGetCPUModelNames(PyObject *self
ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectGetCPUModelNames(conn, arch, &models, flags);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2103,9 +2104,7 @@ libvirt_virConnectGetLibVersion(PyObject *self
ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectGetLibVersion(conn, &libVer);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2132,6 +2131,7 @@ libvirt_virConnectListDomainsID(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfDomains(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2142,6 +2142,7 @@ libvirt_virConnectListDomainsID(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListDomains(conn, ids, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -2186,6 +2187,7 @@ libvirt_virConnectListAllDomains(PyObject *self
ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllDomains(conn, &doms, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -22