diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-09-28 15:03:17 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-09-28 15:03:17 +0200 |
commit | 830adcd58d6b1fbc3e693762ab2e8a8cfd7ecab3 (patch) | |
tree | 4794e4679b0182932c12e8d7b63789ba5dc1ca7f /lib | |
parent | 5c0edba8c2ade663d630a3b9f3ff0c4862129783 (diff) | |
download | samba-830adcd58d6b1fbc3e693762ab2e8a8cfd7ecab3.tar.gz samba-830adcd58d6b1fbc3e693762ab2e8a8cfd7ecab3.tar.bz2 samba-830adcd58d6b1fbc3e693762ab2e8a8cfd7ecab3.zip |
pidl: Avoid using talloc_free as function pointer, since it may be a
macro.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/talloc/pytalloc.c | 10 | ||||
-rw-r--r-- | lib/talloc/pytalloc.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c index 646aac87f2..c6decf33f1 100644 --- a/lib/talloc/pytalloc.c +++ b/lib/talloc/pytalloc.c @@ -81,3 +81,13 @@ PyObject *py_talloc_default_repr(PyObject *obj) return PyString_FromFormat("<%s talloc object at 0x%p>", type->tp_name, talloc_obj->ptr); } + +static void py_cobject_talloc_free(void *ptr) +{ + talloc_free(ptr); +} + +PyObject *PyCObject_FromTallocPtr(void *ptr) +{ + return PyCObject_FromVoidPtr(ptr, py_cobject_talloc_free); +} diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h index 3bfb272958..9b6587261c 100644 --- a/lib/talloc/pytalloc.h +++ b/lib/talloc/pytalloc.h @@ -52,4 +52,6 @@ PyObject *py_talloc_default_repr(PyObject *py_obj); #define py_talloc_new(type, typeobj) py_talloc_steal(typeobj, talloc_zero(NULL, type)) +PyObject *PyCObject_FromTallocPtr(void *); + #endif /* _PY_TALLOC_H_ */ |