summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-23 23:26:32 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-23 23:26:32 +0100
commit30bdb68c9ebe281d8c512f8b737141d76a7c7d68 (patch)
tree2b693c26abf39030b8a81b67819896e8e1f3b00b
parente94e7f82798db59849cb1dc6a99b414adc11594e (diff)
parent5c75b65ca15f7c71babd835a45b252fed6534acf (diff)
downloadsamba-30bdb68c9ebe281d8c512f8b737141d76a7c7d68.tar.gz
samba-30bdb68c9ebe281d8c512f8b737141d76a7c7d68.tar.xz
samba-30bdb68c9ebe281d8c512f8b737141d76a7c7d68.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
-rw-r--r--lib/talloc/pytalloc.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c
index 8bc85eead64..51d087b6d36 100644
--- a/lib/talloc/pytalloc.c
+++ b/lib/talloc/pytalloc.c
@@ -18,8 +18,11 @@
*/
#include <talloc.h>
-#include "../lib/talloc/pytalloc.h"
+#include <pytalloc.h>
+/**
+ * Simple dealloc for talloc-wrapping PyObjects
+ */
void py_talloc_dealloc(PyObject* self)
{
py_talloc_Object *obj = (py_talloc_Object *)self;
@@ -28,6 +31,9 @@ void py_talloc_dealloc(PyObject* self)
self->ob_type->tp_free(self);
}
+/**
+ * Import an existing talloc pointer into a Python object.
+ */
PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
void *ptr)
{
@@ -43,10 +49,14 @@ PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
return (PyObject *)ret;
}
-PyObject *py_talloc_default_repr(PyObject *py_obj)
+/**
+ * Default (but slightly more useful than the default) implementation of Repr().
+ */
+PyObject *py_talloc_default_repr(PyObject *obj)
{
- py_talloc_Object *obj = (py_talloc_Object *)py_obj;
- PyTypeObject *type = (PyTypeObject*)PyObject_Type((PyObject *)obj);
+ py_talloc_Object *talloc_obj = (py_talloc_Object *)obj;
+ PyTypeObject *type = (PyTypeObject*)PyObject_Type(obj);
- return PyString_FromFormat("<%s talloc object at 0x%x>", type->tp_name, (intptr_t)py_obj);
+ return PyString_FromFormat("<%s talloc object at 0x%x>",
+ type->tp_name, (intptr_t)talloc_obj->ptr);
}