is so common that we encapsulate it here. Now, each use is simply
return VIR_PY_NONE; */
#define VIR_PY_NONE (Py_INCREF (Py_None), Py_None)
+#define VIR_PY_INT_FAIL (libvirt_intWrap(-1))
+#define VIR_PY_INT_SUCCESS (libvirt_intWrap(0))
/************************************************************************
* *
c_retval = virDomainGetSchedulerType(domain, &nparams);
if (c_retval == NULL)
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
free(c_retval);
if ((params = malloc(sizeof(*params)*nparams)) == NULL)
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
if (virDomainGetSchedulerParameters(domain, params, &nparams) < 0) {
free(params);
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
}
/* convert to a Python tupple of long objects */
default:
free(params);
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
}
}
if (virDomainSetSchedulerParameters(domain, params, nparams) < 0) {
free(params);
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
}
free(params);
- return VIR_PY_NONE;
+ return VIR_PY_INT_SUCCESS;
}
static PyObject *
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
if (virNodeGetInfo(virDomainGetConnect(domain), &nodeinfo) != 0)
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
cpumaplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo));
if ((cpumap = malloc(cpumaplen)) == NULL)
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
memset(cpumap, 0, cpumaplen);
truth = PyBool_FromLong(1);
Py_DECREF(truth);
free(cpumap);
- return VIR_PY_NONE;
+ return VIR_PY_INT_SUCCESS;
}
LIBVIRT_END_ALLOW_THREADS;
if (c_retval < 0)
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
py_retval = libvirt_intWrap(autostart);
return(py_retval);
}
LIBVIRT_END_ALLOW_THREADS;
if (c_retval < 0)
- return VIR_PY_NONE;
+ return VIR_PY_INT_FAIL;
py_retval = libvirt_intWrap(autostart);
return(py_retval);
}