From 1f0cc6f0816abc15a24a8aa5f97e09c069e29927 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 1 Dec 2010 00:03:08 +0100 Subject: pyregistry: Use talloc.Object. --- source4/lib/registry/pyregistry.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c index 8b75bbb60d..b93258a856 100644 --- a/source4/lib/registry/pyregistry.c +++ b/source4/lib/registry/pyregistry.c @@ -159,7 +159,6 @@ PyTypeObject PyRegistry = { .tp_methods = registry_methods, .tp_new = registry_new, .tp_basicsize = sizeof(py_talloc_Object), - .tp_dealloc = py_talloc_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT, }; @@ -297,14 +296,12 @@ PyTypeObject PyHiveKey = { .tp_methods = hive_key_methods, .tp_new = hive_new, .tp_basicsize = sizeof(py_talloc_Object), - .tp_dealloc = py_talloc_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT, }; PyTypeObject PyRegistryKey = { .tp_name = "RegistryKey", .tp_basicsize = sizeof(py_talloc_Object), - .tp_dealloc = py_talloc_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT, }; @@ -354,7 +351,7 @@ static PyObject *py_open_samba(PyObject *self, PyObject *args, PyObject *kwargs) PyErr_SetWERROR(result); return NULL; } - + return py_talloc_steal(&PyRegistry, reg_ctx); } @@ -474,6 +471,14 @@ static PyMethodDef py_registry_methods[] = { void initregistry(void) { PyObject *m; + PyTypeObject *talloc_type = PyTalloc_GetObjectType(); + + if (talloc_type == NULL) + return; + + PyHiveKey.tp_base = talloc_type; + PyRegistry.tp_base = talloc_type; + PyRegistryKey.tp_base = talloc_type; if (PyType_Ready(&PyHiveKey) < 0) return; -- cgit