summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-07-30 20:04:42 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-07-30 20:04:42 +0200
commit6768cfe624fffef13109989e9cc79ccb4df13d19 (patch)
tree118d663f818c26bd28afbfded01dc8fd6651402e /lib/talloc
parenteda7f35bc891ca4a7505ec054a2b4591c6edfb38 (diff)
downloadsamba-6768cfe624fffef13109989e9cc79ccb4df13d19.tar.gz
samba-6768cfe624fffef13109989e9cc79ccb4df13d19.tar.bz2
samba-6768cfe624fffef13109989e9cc79ccb4df13d19.zip
DCE/RPC(Python): Rename py_talloc_import to py_talloc_steal.
Use py_talloc_reference in DCE/RPC code, fixes access to SAMR pipe.
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/pytalloc.c6
-rw-r--r--lib/talloc/pytalloc.h9
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c
index 3ce49d6d61..646aac87f2 100644
--- a/lib/talloc/pytalloc.c
+++ b/lib/talloc/pytalloc.c
@@ -35,7 +35,7 @@ void py_talloc_dealloc(PyObject* self)
/**
* Import an existing talloc pointer into a Python object.
*/
-PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
+PyObject *py_talloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
void *ptr)
{
py_talloc_Object *ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0);
@@ -56,14 +56,14 @@ PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
* original parent, and creating a reference to the object in the python
* object
*/
-PyObject *py_talloc_reference(PyTypeObject *py_type, void *ptr)
+PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr)
{
py_talloc_Object *ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0);
ret->talloc_ctx = talloc_new(NULL);
if (ret->talloc_ctx == NULL) {
return NULL;
}
- if (talloc_reference(ret->talloc_ctx, ptr) == NULL) {
+ if (talloc_reference(ret->talloc_ctx, mem_ctx) == NULL) {
return NULL;
}
ret->ptr = ptr;
diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h
index 00282c4ba0..3bfb272958 100644
--- a/lib/talloc/pytalloc.h
+++ b/lib/talloc/pytalloc.h
@@ -42,13 +42,14 @@ void py_talloc_dealloc(PyObject* self);
#define py_talloc_get_ptr(py_obj) (((py_talloc_Object *)py_obj)->ptr)
#define py_talloc_get_mem_ctx(py_obj) ((py_talloc_Object *)py_obj)->talloc_ctx
-PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
-PyObject *py_talloc_reference(PyTypeObject *py_type, void *ptr);
-#define py_talloc_import(py_type, talloc_ptr) py_talloc_import_ex(py_type, talloc_ptr, talloc_ptr)
+PyObject *py_talloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
+PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
+#define py_talloc_steal(py_type, talloc_ptr) py_talloc_steal_ex(py_type, talloc_ptr, talloc_ptr)
+#define py_talloc_reference(py_type, talloc_ptr) py_talloc_reference_ex(py_type, talloc_ptr, talloc_ptr)
/* Sane default implementation of reprfunc. */
PyObject *py_talloc_default_repr(PyObject *py_obj);
-#define py_talloc_new(type, typeobj) py_talloc_import(typeobj, talloc_zero(NULL, type))
+#define py_talloc_new(type, typeobj) py_talloc_steal(typeobj, talloc_zero(NULL, type))
#endif /* _PY_TALLOC_H_ */