summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libvir.c23
-rw-r--r--libvirt_wrap.h1
-rw-r--r--types.c16
3 files changed, 34 insertions, 6 deletions
diff --git a/libvir.c b/libvir.c
index 8fb9d60..07ed09e 100644
--- a/libvir.c
+++ b/libvir.c
@@ -1704,12 +1704,16 @@ static PyObject *removeTimeoutObj = NULL;
static int
-libvirt_virEventAddHandleFunc (int fd ATTRIBUTE_UNUSED, int event ATTRIBUTE_UNUSED,
- virEventHandleCallback cb, void *opaque)
+libvirt_virEventAddHandleFunc (int fd,
+ int event,
+ virEventHandleCallback cb,
+ void *opaque,
+ virFreeCallback ff)
{
PyObject *result = NULL;
PyObject *python_cb;
PyObject *cb_obj;
+ PyObject *ff_obj;
PyObject *opaque_obj;
PyObject *cb_args;
PyObject *pyobj_args;
@@ -1730,11 +1734,13 @@ libvirt_virEventAddHandleFunc (int fd ATTRIBUTE_UNUSED, int event ATTRIBUTE_UNU
/* create tuple for cb */
cb_obj = libvirt_virEventHandleCallbackWrap(cb);
+ ff_obj = libvirt_virFreeCallbackWrap(ff);
opaque_obj = libvirt_virVoidPtrWrap(opaque);
- cb_args = PyTuple_New(2);
+ cb_args = PyTuple_New(3);
PyTuple_SetItem(cb_args, 0, cb_obj);
PyTuple_SetItem(cb_args, 1, opaque_obj);
+ PyTuple_SetItem(cb_args, 2, ff_obj);
pyobj_args = PyTuple_New(4);
PyTuple_SetItem(pyobj_args, 0, libvirt_intWrap(fd));
@@ -1799,14 +1805,17 @@ libvirt_virEventRemoveHandleFunc(int fd)
}
static int
-libvirt_virEventAddTimeoutFunc(int timeout, virEventTimeoutCallback cb,
- void *opaque)
+libvirt_virEventAddTimeoutFunc(int timeout,
+ virEventTimeoutCallback cb,
+ void *opaque,
+ virFreeCallback ff)
{
PyObject *result = NULL;
PyObject *python_cb;
PyObject *cb_obj;
+ PyObject *ff_obj;
PyObject *opaque_obj;
PyObject *cb_args;
PyObject *pyobj_args;
@@ -1827,11 +1836,13 @@ libvirt_virEventAddTimeoutFunc(int timeout, virEventTimeoutCallback cb,
/* create tuple for cb */
cb_obj = libvirt_virEventTimeoutCallbackWrap(cb);
+ ff_obj = libvirt_virFreeCallbackWrap(ff);
opaque_obj = libvirt_virVoidPtrWrap(opaque);
- cb_args = PyTuple_New(2);
+ cb_args = PyTuple_New(3);
PyTuple_SetItem(cb_args, 0, cb_obj);
PyTuple_SetItem(cb_args, 1, opaque_obj);
+ PyTuple_SetItem(cb_args, 2, ff_obj);
pyobj_args = PyTuple_New(3);
diff --git a/libvirt_wrap.h b/libvirt_wrap.h
index b46deaf..b3cbcb8 100644
--- a/libvirt_wrap.h
+++ b/libvirt_wrap.h
@@ -103,6 +103,7 @@ PyObject * libvirt_virStoragePoolPtrWrap(virStoragePoolPtr node);
PyObject * libvirt_virStorageVolPtrWrap(virStorageVolPtr node);
PyObject * libvirt_virEventHandleCallbackWrap(virEventHandleCallback node);
PyObject * libvirt_virEventTimeoutCallbackWrap(virEventTimeoutCallback node);
+PyObject * libvirt_virFreeCallbackWrap(virFreeCallback node);
PyObject * libvirt_virVoidPtrWrap(void* node);
/* Provide simple macro statement wrappers (adapted from GLib, in turn from Perl):
diff --git a/types.c b/types.c
index 1c1db89..4285134 100644
--- a/types.c
+++ b/types.c
@@ -196,6 +196,22 @@ libvirt_virEventTimeoutCallbackWrap(virEventTimeoutCallback node)
}
PyObject *
+libvirt_virFreeCallbackWrap(virFreeCallback node)
+{
+ PyObject *ret;
+
+ if (node == NULL) {
+ printf("%s: WARNING - Wrapping None\n", __FUNCTION__);
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virFreeCallback",
+ NULL);
+ return (ret);
+}
+
+PyObject *
libvirt_virVoidPtrWrap(void* node)
{
PyObject *ret;