The Samba-Bugzilla – Attachment 5081 Details for
Bug 6952
Suggestion: Move internal pytalloc.h away from talloc.h
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
samba-3.4.3-pytalloc.h-subdir.patch
samba-3.4.3-pytalloc.h-subdir.patch (text/plain), 9.57 KB, created by
Torsten Kurbad
on 2009-12-10 16:10:32 UTC
(
hide
)
Description:
samba-3.4.3-pytalloc.h-subdir.patch
Filename:
MIME Type:
Creator:
Torsten Kurbad
Created:
2009-12-10 16:10:32 UTC
Size:
9.57 KB
patch
obsolete
>diff --git a/lib/talloc/libtalloc.m4 b/lib/talloc/libtalloc.m4 >index e6830fb..d4559d8 100644 >--- a/lib/talloc/libtalloc.m4 >+++ b/lib/talloc/libtalloc.m4 >@@ -15,7 +15,7 @@ fi > TALLOC_OBJ="talloc.o" > AC_SUBST(TALLOC_OBJ) > >-TALLOC_CFLAGS="-I$srcdir/$tallocdir" >+TALLOC_CFLAGS="-I$srcdir/$tallocdir -I$srcdir/$tallocdir/python" > AC_SUBST(TALLOC_CFLAGS) > > TALLOC_LIBS="" >diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c >deleted file mode 100644 >index 30da9ee..0000000 >--- a/lib/talloc/pytalloc.c >+++ /dev/null >@@ -1,63 +0,0 @@ >-/* >- Unix SMB/CIFS implementation. >- Python/Talloc glue >- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008 >- >- This program is free software; you can redistribute it and/or modify >- it under the terms of the GNU General Public License as published by >- the Free Software Foundation; either version 3 of the License, or >- (at your option) any later version. >- >- This program is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >- GNU General Public License for more details. >- >- You should have received a copy of the GNU General Public License >- along with this program. If not, see <http://www.gnu.org/licenses/>. >-*/ >- >-#include "replace.h" >-#include <talloc.h> >-#include <pytalloc.h> >- >-/** >- * Simple dealloc for talloc-wrapping PyObjects >- */ >-void py_talloc_dealloc(PyObject* self) >-{ >- py_talloc_Object *obj = (py_talloc_Object *)self; >- talloc_free(obj->talloc_ctx); >- obj->talloc_ctx = NULL; >- 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) >-{ >- 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, mem_ctx) == NULL) { >- return NULL; >- } >- ret->ptr = ptr; >- return (PyObject *)ret; >-} >- >-/** >- * Default (but slightly more useful than the default) implementation of Repr(). >- */ >-PyObject *py_talloc_default_repr(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)talloc_obj->ptr); >-} >diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h >deleted file mode 100644 >index c5a1428..0000000 >--- a/lib/talloc/pytalloc.h >+++ /dev/null >@@ -1,53 +0,0 @@ >-/* >- Unix SMB/CIFS implementation. >- Samba utility functions >- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008 >- >- This program is free software; you can redistribute it and/or modify >- it under the terms of the GNU General Public License as published by >- the Free Software Foundation; either version 3 of the License, or >- (at your option) any later version. >- >- This program is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >- GNU General Public License for more details. >- >- You should have received a copy of the GNU General Public License >- along with this program. If not, see <http://www.gnu.org/licenses/>. >-*/ >- >-#ifndef _PY_TALLOC_H_ >-#define _PY_TALLOC_H_ >- >-#include <Python.h> >-#include <talloc.h> >- >-typedef struct { >- PyObject_HEAD >- TALLOC_CTX *talloc_ctx; >- void *ptr; >-} py_talloc_Object; >- >-/* Deallocate a py_talloc_Object */ >-void py_talloc_dealloc(PyObject* self); >- >-/* Retrieve the pointer for a py_talloc_object. Like talloc_get_type() >- * but for py_talloc_Objects. */ >- >-/* FIXME: Call PyErr_SetString(PyExc_TypeError, "expected " __STR(type) ") >- * when talloc_get_type() returns NULL. */ >-#define py_talloc_get_type(py_obj, type) (talloc_get_type(py_talloc_get_ptr(py_obj), type)) >- >-#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); >-#define py_talloc_import(py_type, talloc_ptr) py_talloc_import_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)) >- >-#endif /* _PY_TALLOC_H_ */ >diff --git a/lib/talloc/python/pytalloc.c b/lib/talloc/python/pytalloc.c >new file mode 100644 >index 0000000..30da9ee >--- /dev/null >+++ b/lib/talloc/python/pytalloc.c >@@ -0,0 +1,63 @@ >+/* >+ Unix SMB/CIFS implementation. >+ Python/Talloc glue >+ Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008 >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 3 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program. If not, see <http://www.gnu.org/licenses/>. >+*/ >+ >+#include "replace.h" >+#include <talloc.h> >+#include <pytalloc.h> >+ >+/** >+ * Simple dealloc for talloc-wrapping PyObjects >+ */ >+void py_talloc_dealloc(PyObject* self) >+{ >+ py_talloc_Object *obj = (py_talloc_Object *)self; >+ talloc_free(obj->talloc_ctx); >+ obj->talloc_ctx = NULL; >+ 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) >+{ >+ 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, mem_ctx) == NULL) { >+ return NULL; >+ } >+ ret->ptr = ptr; >+ return (PyObject *)ret; >+} >+ >+/** >+ * Default (but slightly more useful than the default) implementation of Repr(). >+ */ >+PyObject *py_talloc_default_repr(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)talloc_obj->ptr); >+} >diff --git a/lib/talloc/python/pytalloc.h b/lib/talloc/python/pytalloc.h >new file mode 100644 >index 0000000..c5a1428 >--- /dev/null >+++ b/lib/talloc/python/pytalloc.h >@@ -0,0 +1,53 @@ >+/* >+ Unix SMB/CIFS implementation. >+ Samba utility functions >+ Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008 >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 3 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program. If not, see <http://www.gnu.org/licenses/>. >+*/ >+ >+#ifndef _PY_TALLOC_H_ >+#define _PY_TALLOC_H_ >+ >+#include <Python.h> >+#include <talloc.h> >+ >+typedef struct { >+ PyObject_HEAD >+ TALLOC_CTX *talloc_ctx; >+ void *ptr; >+} py_talloc_Object; >+ >+/* Deallocate a py_talloc_Object */ >+void py_talloc_dealloc(PyObject* self); >+ >+/* Retrieve the pointer for a py_talloc_object. Like talloc_get_type() >+ * but for py_talloc_Objects. */ >+ >+/* FIXME: Call PyErr_SetString(PyExc_TypeError, "expected " __STR(type) ") >+ * when talloc_get_type() returns NULL. */ >+#define py_talloc_get_type(py_obj, type) (talloc_get_type(py_talloc_get_ptr(py_obj), type)) >+ >+#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); >+#define py_talloc_import(py_type, talloc_ptr) py_talloc_import_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)) >+ >+#endif /* _PY_TALLOC_H_ */ >diff --git a/source3/configure.in b/source3/configure.in >index 1034509..90b4b0e 100644 >--- a/source3/configure.in >+++ b/source3/configure.in >@@ -42,6 +42,10 @@ fi > if test "x$enable_external_libtalloc" != xyes > then > m4_include(../lib/talloc/libtalloc.m4) >+else >+ tallocdir="../lib/talloc" >+ TALLOC_CFLAGS="-I${srcdir-.}/$tallocdir/python" >+ AC_SUBST(TALLOC_CFLAGS) > fi > > m4_include(../lib/tevent/libtevent.m4) >diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk >index ba624ee..e5ea5d8 100644 >--- a/source4/scripting/python/config.mk >+++ b/source4/scripting/python/config.mk >@@ -8,7 +8,7 @@ LIBPYTHON_OBJ_FILES = $(addprefix $(pyscriptsrcdir)/, modules.o) > [SUBSYSTEM::PYTALLOC] > PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON LIBTALLOC > >-PYTALLOC_OBJ_FILES = ../lib/talloc/pytalloc.o >+PYTALLOC_OBJ_FILES = ../lib/talloc/python/pytalloc.o > > [PYTHON::python_uuid] > PRIVATE_DEPENDENCIES = LIBNDR
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6952
:
5041
| 5081