diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-07-18 16:11:21 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-07-18 16:11:21 +0200 |
commit | d356669492912ad97d031694123b628a9307c3bd (patch) | |
tree | 86f1e6d34980ef39c4d56b9e719195480b11817e /source4 | |
parent | 8c5aff207d25764dd457050c2e5975b4b42c917f (diff) | |
download | samba-d356669492912ad97d031694123b628a9307c3bd.tar.gz samba-d356669492912ad97d031694123b628a9307c3bd.tar.bz2 samba-d356669492912ad97d031694123b628a9307c3bd.zip |
Remove pyldb_util and simply duplicate the 5-line function it contains,
rather than creating a separate shared library for it.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/ldb.mk | 7 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb.c | 10 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb.h | 1 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb_util.c | 39 | ||||
-rw-r--r-- | source4/lib/ldb/python.mk | 8 | ||||
-rw-r--r-- | source4/scripting/python/pyglue.c | 9 |
6 files changed, 21 insertions, 53 deletions
diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index a9a6dad46d..4234fcc311 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -67,11 +67,8 @@ build-python:: ldb.$(SHLIBEXT) pyldb.o: $(ldbdir)/pyldb.c $(CC) $(PICFLAG) -c $(ldbdir)/pyldb.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` -pyldb_util.o: $(ldbdir)/pyldb_util.c - $(CC) $(PICFLAG) -c $(ldbdir)/pyldb_util.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` - -ldb.$(SHLIBEXT): pyldb.o pyldb_util.o - $(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o pyldb_util.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags` +ldb.$(SHLIBEXT): pyldb.o + $(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags` install-python:: build-python mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 2e0f4fdf36..bcca70eb82 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -41,6 +41,16 @@ typedef intargfunc ssizeargfunc; #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None #endif +static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_ctx) +{ + if (ret == LDB_ERR_PYTHON_EXCEPTION) + return; /* Python exception should already be set, just keep that */ + + PyErr_SetObject(error, + Py_BuildValue(discard_const_p(char, "(i,s)"), ret, + ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx))); +} + static PyObject *PyExc_LdbError; PyAPI_DATA(PyTypeObject) PyLdbMessage; diff --git a/source4/lib/ldb/pyldb.h b/source4/lib/ldb/pyldb.h index e0e0d2af69..a0954158bd 100644 --- a/source4/lib/ldb/pyldb.h +++ b/source4/lib/ldb/pyldb.h @@ -85,7 +85,6 @@ typedef struct { PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *); #define PyLdbTree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree -void PyErr_SetLdbError(PyObject *exctype, int ret, struct ldb_context *ldb_ctx); #define PyErr_LDB_ERROR_IS_ERR_RAISE(err,ret,ldb) \ if (ret != LDB_SUCCESS) { \ PyErr_SetLdbError(err, ret, ldb); \ diff --git a/source4/lib/ldb/pyldb_util.c b/source4/lib/ldb/pyldb_util.c deleted file mode 100644 index 84183e89de..0000000000 --- a/source4/lib/ldb/pyldb_util.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - interface to ldb. - - Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org> - - ** NOTE! The following LGPL license applies to the ldb - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "replace.h" -#include <Python.h> -#include "pyldb.h" -#include <ldb.h> - -void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_ctx) -{ - if (ret == LDB_ERR_PYTHON_EXCEPTION) - return; /* Python exception should already be set, just keep that */ - - PyErr_SetObject(error, - Py_BuildValue(discard_const_p(char, "(i,s)"), ret, - ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx))); -} diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index e08c150aaf..dbc2eb27eb 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -1,14 +1,6 @@ [PYTHON::pyldb] LIBRARY_REALNAME = ldb.$(SHLIBEXT) PUBLIC_DEPENDENCIES = LIBLDB PYTALLOC -PRIVATE_DEPENDENCIES = pyldb_util pyldb_OBJ_FILES = $(ldbsrcdir)/pyldb.o $(pyldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include - -[SUBSYSTEM::pyldb_util] -PUBLIC_DEPENDENCIES = LIBPYTHON -PRIVATE_DEPENDENCIES = LIBLDB - -pyldb_util_OBJ_FILES = $(ldbsrcdir)/pyldb_util.o -$(pyldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index c6b731ce8b..0869d2feac 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -46,6 +46,15 @@ } */\ ldb = PyLdb_AsLdbContext(py_ldb); +static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_ctx) +{ + if (ret == LDB_ERR_PYTHON_EXCEPTION) + return; /* Python exception should already be set, just keep that */ + + PyErr_SetObject(error, + Py_BuildValue(discard_const_p(char, "(i,s)"), ret, + ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx))); +} static PyObject *py_ldb_get_exception(void) { |