From: Andrew Bartlett Date: Mon, 29 Feb 2016 03:26:08 +0000 (+1300) Subject: pycredentials: Remove PyCredentialCacheContainerObject X-Git-Tag: talloc-2.1.6~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=750632199641ff437585bc3a6835e282ce1d5395;p=thirdparty%2Fsamba.git pycredentials: Remove PyCredentialCacheContainerObject We can call pytalloc_reference() and avoid having this in the header file Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c index e1c0b3ece75..77671d0b416 100644 --- a/auth/credentials/pycredentials.c +++ b/auth/credentials/pycredentials.c @@ -315,20 +315,7 @@ static PyObject *py_creds_set_machine_account(PyObject *self, PyObject *args) static PyObject *PyCredentialCacheContainer_from_ccache_container(struct ccache_container *ccc) { - PyCredentialCacheContainerObject *py_ret; - - if (ccc == NULL) { - Py_RETURN_NONE; - } - - py_ret = (PyCredentialCacheContainerObject *)PyCredentialCacheContainer.tp_alloc(&PyCredentialCacheContainer, 0); - if (py_ret == NULL) { - PyErr_NoMemory(); - return NULL; - } - py_ret->mem_ctx = talloc_new(NULL); - py_ret->ccc = talloc_reference(py_ret->mem_ctx, ccc); - return (PyObject *)py_ret; + return pytalloc_reference(&PyCredentialCacheContainer, ccc); } diff --git a/auth/credentials/pycredentials.h b/auth/credentials/pycredentials.h index 3a110fb09a5..a136a210da3 100644 --- a/auth/credentials/pycredentials.h +++ b/auth/credentials/pycredentials.h @@ -24,11 +24,6 @@ extern PyTypeObject PyCredentials; extern PyTypeObject PyCredentialCacheContainer; -typedef struct { - PyObject_HEAD - TALLOC_CTX *mem_ctx; - struct ccache_container *ccc; -} PyCredentialCacheContainerObject; #define PyCredentials_Check(py_obj) PyObject_TypeCheck(py_obj, &PyCredentials) #define PyCredentials_AsCliCredentials(py_obj) pytalloc_get_type(py_obj, struct cli_credentials) #define cli_credentials_from_py_object(py_obj) (py_obj == Py_None)?cli_credentials_init_anon(NULL):PyCredentials_AsCliCredentials(py_obj)