1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

pytalloc: Make py_talloc_dealloc private.

This commit is contained in:
Jelmer Vernooij 2010-12-01 00:14:27 +01:00
parent 4f0436f107
commit b8dc3c8a83
3 changed files with 11 additions and 14 deletions

View File

@ -86,6 +86,17 @@ static PyObject *py_talloc_default_repr(PyObject *obj)
type->tp_name, talloc_obj->ptr); type->tp_name, talloc_obj->ptr);
} }
/**
* Simple dealloc for talloc-wrapping PyObjects
*/
static void py_talloc_dealloc(PyObject* self)
{
py_talloc_Object *obj = (py_talloc_Object *)self;
assert(talloc_unlink(NULL, obj->talloc_ctx) != -1);
obj->talloc_ctx = NULL;
self->ob_type->tp_free(self);
}
static PyTypeObject TallocObject_Type = { static PyTypeObject TallocObject_Type = {
.tp_name = "talloc.Object", .tp_name = "talloc.Object",
.tp_basicsize = sizeof(py_talloc_Object), .tp_basicsize = sizeof(py_talloc_Object),

View File

@ -29,9 +29,6 @@ typedef struct {
void *ptr; void *ptr;
} py_talloc_Object; } py_talloc_Object;
/* Deallocate a py_talloc_Object */
void py_talloc_dealloc(PyObject* self);
PyTypeObject *PyTalloc_GetObjectType(void); PyTypeObject *PyTalloc_GetObjectType(void);
int PyTalloc_Check(PyObject *); int PyTalloc_Check(PyObject *);

View File

@ -43,17 +43,6 @@ PyTypeObject *PyTalloc_GetObjectType(void)
return type; return type;
} }
/**
* Simple dealloc for talloc-wrapping PyObjects
*/
void py_talloc_dealloc(PyObject* self)
{
py_talloc_Object *obj = (py_talloc_Object *)self;
assert(talloc_unlink(NULL, obj->talloc_ctx) != -1);
obj->talloc_ctx = NULL;
self->ob_type->tp_free(self);
}
/** /**
* Import an existing talloc pointer into a Python object. * Import an existing talloc pointer into a Python object.
*/ */