diff options
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r-- | source4/lib/tdb/common/traverse.c | 22 | ||||
-rw-r--r-- | source4/lib/tdb/configure.ac | 2 | ||||
-rw-r--r-- | source4/lib/tdb/python.mk | 7 | ||||
-rw-r--r-- | source4/lib/tdb/python/tests/simple.py | 7 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.i | 47 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.mk | 4 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.py | 186 | ||||
-rw-r--r-- | source4/lib/tdb/tdb_wrap.c | 283 |
8 files changed, 400 insertions, 158 deletions
diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c index 07b0c23858..69c81e6e98 100644 --- a/source4/lib/tdb/common/traverse.c +++ b/source4/lib/tdb/common/traverse.c @@ -204,18 +204,23 @@ int tdb_traverse_read(struct tdb_context *tdb, { struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK }; int ret; + bool in_transaction = (tdb->transaction != NULL); /* we need to get a read lock on the transaction lock here to cope with the lock ordering semantics of solaris10 */ - if (tdb_transaction_lock(tdb, F_RDLCK)) { - return -1; + if (!in_transaction) { + if (tdb_transaction_lock(tdb, F_RDLCK)) { + return -1; + } } tdb->traverse_read++; ret = tdb_traverse_internal(tdb, fn, private_data, &tl); tdb->traverse_read--; - tdb_transaction_unlock(tdb); + if (!in_transaction) { + tdb_transaction_unlock(tdb); + } return ret; } @@ -232,20 +237,25 @@ int tdb_traverse(struct tdb_context *tdb, { struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK }; int ret; + bool in_transaction = (tdb->transaction != NULL); if (tdb->read_only || tdb->traverse_read) { return tdb_traverse_read(tdb, fn, private_data); } - if (tdb_transaction_lock(tdb, F_WRLCK)) { - return -1; + if (!in_transaction) { + if (tdb_transaction_lock(tdb, F_WRLCK)) { + return -1; + } } tdb->traverse_write++; ret = tdb_traverse_internal(tdb, fn, private_data, &tl); tdb->traverse_write--; - tdb_transaction_unlock(tdb); + if (!in_transaction) { + tdb_transaction_unlock(tdb); + } return ret; } diff --git a/source4/lib/tdb/configure.ac b/source4/lib/tdb/configure.ac index 9b16a82c33..eaf70d30b4 100644 --- a/source4/lib/tdb/configure.ac +++ b/source4/lib/tdb/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.50) AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""]) AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) AC_DEFUN([SMB_ENABLE], [echo -n ""]) -AC_INIT(tdb, 1.1.1) +AC_INIT(tdb, 1.1.2) AC_CONFIG_SRCDIR([common/tdb.c]) AC_CONFIG_HEADER(include/config.h) AC_LIBREPLACE_ALL_CHECKS diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index 2d61545b7f..83336e7b41 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -1,5 +1,10 @@ [PYTHON::swig_tdb] -SWIG_FILE = tdb.i +LIBRARY_REALNAME = _tdb.$(SHLIBEXT) PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o + +$(eval $(call python_py_module_template,tdb.py,lib/tdb/tdb.py)) + +$(swig_tdb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL) + diff --git a/source4/lib/tdb/python/tests/simple.py b/source4/lib/tdb/python/tests/simple.py index 94407b6398..7147718c91 100644 --- a/source4/lib/tdb/python/tests/simple.py +++ b/source4/lib/tdb/python/tests/simple.py @@ -3,8 +3,8 @@ # Note that this tests the interface of the Python bindings # It does not test tdb itself. # -# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org> -# Published under the GNU LGPL +# Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org> +# Published under the GNU LGPLv3 or later import tdb from unittest import TestCase @@ -25,6 +25,9 @@ class SimpleTdbTests(TestCase): def tearDown(self): del self.tdb + def test_repr(self): + self.assertTrue(repr(self.tdb).startswith("Tdb('")) + def test_lockall(self): self.tdb.lock_all() diff --git a/source4/lib/tdb/tdb.i b/source4/lib/tdb/tdb.i index c82d2d0a6d..5f23568170 100644 --- a/source4/lib/tdb/tdb.i +++ b/source4/lib/tdb/tdb.i @@ -24,7 +24,11 @@ License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -%module tdb +%define DOCSTRING +"TDB is a simple key-value database similar to GDBM that supports multiple writers." +%enddef + +%module(docstring=DOCSTRING) tdb %{ @@ -138,7 +142,8 @@ enum TDB_ERROR { $1 = TDB_REPLACE; } -%rename(Tdb) tdb; +%rename(Tdb) tdb_context; +%feature("docstring") tdb_context "A TDB file."; %typemap(out,noblock=1) tdb * { /* Throw an IOError exception from errno if tdb_open() returns NULL */ if ($1 == NULL) { @@ -150,40 +155,74 @@ enum TDB_ERROR { typedef struct tdb_context { %extend { + %feature("docstring") tdb "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n" + "Open a TDB file."; tdb(const char *name, int hash_size, int tdb_flags, int flags, mode_t mode) { return tdb_open(name, hash_size, tdb_flags, flags, mode); } enum TDB_ERROR error(); ~tdb() { tdb_close($self); } + %feature("docstring") close "S.close() -> None\n" + "Close the TDB file."; int close(); int append(TDB_DATA key, TDB_DATA new_dbuf); + %feature("docstring") errorstr "S.errorstr() -> errorstring\n" + "Obtain last error message."; const char *errorstr(); %rename(get) fetch; + %feature("docstring") fetch "S.fetch(key) -> value\n" + "Fetch a value."; TDB_DATA fetch(TDB_DATA key); + %feature("docstring") delete "S.delete(key) -> None\n" + "Delete an entry."; int delete(TDB_DATA key); + %feature("docstring") store "S.store(key, value, flag=TDB_REPLACE) -> None\n" + "Store an entry."; int store(TDB_DATA key, TDB_DATA dbuf, int flag); int exists(TDB_DATA key); + %feature("docstring") firstkey "S.firstkey() -> data\n" + "Return the first key in this database."; TDB_DATA firstkey(); + %feature("docstring") nextkey "S.nextkey(prev) -> data\n" + "Return the next key in this database."; TDB_DATA nextkey(TDB_DATA key); + %feature("docstring") lockall "S.lockall() -> bool"; int lockall(); + %feature("docstring") unlockall "S.unlockall() -> bool"; int unlockall(); + %feature("docstring") unlockall "S.lockall_read() -> bool"; int lockall_read(); + %feature("docstring") unlockall "S.unlockall_read() -> bool"; int unlockall_read(); + %feature("docstring") reopen "S.reopen() -> bool\n" + "Reopen this file."; int reopen(); + %feature("docstring") transaction_start "S.transaction_start() -> None\n" + "Start a new transaction."; int transaction_start(); + %feature("docstring") transaction_commit "S.transaction_commit() -> None\n" + "Commit the currently active transaction."; int transaction_commit(); + %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n" + "Cancel the currently active transaction."; int transaction_cancel(); int transaction_recover(); + %feature("docstring") hash_size "S.hash_size() -> int"; int hash_size(); + %feature("docstring") map_size "S.map_size() -> int"; size_t map_size(); + %feature("docstring") get_flags "S.get_flags() -> int"; int get_flags(); + %feature("docstring") set_max_dead "S.set_max_dead(int) -> None"; void set_max_dead(int max_dead); + %feature("docstring") name "S.name() -> path\n" \ + "Return filename of this TDB file."; const char *name(); } %pythoncode { - def __str__(self): - return self.name() + def __repr__(self): + return "Tdb('%s')" % self.name() # Random access to keys, values def __getitem__(self, key): diff --git a/source4/lib/tdb/tdb.mk b/source4/lib/tdb/tdb.mk index 0e53927366..fa8db6d34c 100644 --- a/source4/lib/tdb/tdb.mk +++ b/source4/lib/tdb/tdb.mk @@ -39,7 +39,7 @@ tdb_wrap.o: $(tdbdir)/tdb_wrap.c $(CC) $(PICFLAG) -c $(tdbdir)/tdb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` _tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o - $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --libs` + $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --ldflags` install:: installdirs installbin installheaders installlibs \ $(PYTHON_INSTALL_TARGET) @@ -50,7 +50,7 @@ install-python:: build-python cp $(tdbdir)/tdb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` cp _tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` -check-python:: build-python +check-python:: build-python $(TDB_SONAME) $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py install-swig:: diff --git a/source4/lib/tdb/tdb.py b/source4/lib/tdb/tdb.py index 0effa3ff98..a8c1d06e0d 100644 --- a/source4/lib/tdb/tdb.py +++ b/source4/lib/tdb/tdb.py @@ -1,8 +1,12 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. +""" +TDB is a simple key-value database similar to GDBM that supports multiple writers. +""" + import _tdb import new new_instancemethod = new.instancemethod @@ -78,13 +82,127 @@ TDB_ERR_LOCK_TIMEOUT = _tdb.TDB_ERR_LOCK_TIMEOUT TDB_ERR_NOEXIST = _tdb.TDB_ERR_NOEXIST TDB_ERR_EINVAL = _tdb.TDB_ERR_EINVAL TDB_ERR_RDONLY = _tdb.TDB_ERR_RDONLY -class tdb(object): +class Tdb(object): + """A TDB file.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - __swig_destroy__ = _tdb.delete_tdb - def __str__(self): - return self.name() + def __init__(self, *args, **kwargs): + """ + S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600) + Open a TDB file. + """ + _tdb.Tdb_swiginit(self,_tdb.new_Tdb(*args, **kwargs)) + __swig_destroy__ = _tdb.delete_Tdb + def close(*args, **kwargs): + """ + S.close() -> None + Close the TDB file. + """ + return _tdb.Tdb_close(*args, **kwargs) + + def errorstr(*args, **kwargs): + """ + S.errorstr() -> errorstring + Obtain last error message. + """ + return _tdb.Tdb_errorstr(*args, **kwargs) + + def get(*args, **kwargs): + """ + S.fetch(key) -> value + Fetch a value. + """ + return _tdb.Tdb_get(*args, **kwargs) + + def delete(*args, **kwargs): + """ + S.delete(key) -> None + Delete an entry. + """ + return _tdb.Tdb_delete(*args, **kwargs) + + def store(*args, **kwargs): + """ + S.store(key, value, flag=TDB_REPLACE) -> None + Store an entry. + """ + return _tdb.Tdb_store(*args, **kwargs) + + def firstkey(*args, **kwargs): + """ + S.firstkey() -> data + Return the first key in this database. + """ + return _tdb.Tdb_firstkey(*args, **kwargs) + + def nextkey(*args, **kwargs): + """ + S.nextkey(prev) -> data + Return the next key in this database. + """ + return _tdb.Tdb_nextkey(*args, **kwargs) + + def lock_all(*args, **kwargs): + """S.lockall() -> bool""" + return _tdb.Tdb_lock_all(*args, **kwargs) + + def unlock_all(*args, **kwargs): + """S.unlockall() -> bool""" + return _tdb.Tdb_unlock_all(*args, **kwargs) + + def reopen(*args, **kwargs): + """ + S.reopen() -> bool + Reopen this file. + """ + return _tdb.Tdb_reopen(*args, **kwargs) + + def transaction_start(*args, **kwargs): + """ + S.transaction_start() -> None + Start a new transaction. + """ + return _tdb.Tdb_transaction_start(*args, **kwargs) + + def transaction_commit(*args, **kwargs): + """ + S.transaction_commit() -> None + Commit the currently active transaction. + """ + return _tdb.Tdb_transaction_commit(*args, **kwargs) + + def transaction_cancel(*args, **kwargs): + """ + S.transaction_cancel() -> None + Cancel the currently active transaction. + """ + return _tdb.Tdb_transaction_cancel(*args, **kwargs) + + def hash_size(*args, **kwargs): + """S.hash_size() -> int""" + return _tdb.Tdb_hash_size(*args, **kwargs) + + def map_size(*args, **kwargs): + """S.map_size() -> int""" + return _tdb.Tdb_map_size(*args, **kwargs) + + def get_flags(*args, **kwargs): + """S.get_flags() -> int""" + return _tdb.Tdb_get_flags(*args, **kwargs) + + def set_max_dead(*args, **kwargs): + """S.set_max_dead(int) -> None""" + return _tdb.Tdb_set_max_dead(*args, **kwargs) + + def name(*args, **kwargs): + """ + S.name() -> path + Return filename of this TDB file. + """ + return _tdb.Tdb_name(*args, **kwargs) + + def __repr__(self): + return "Tdb('%s')" % self.name() def __getitem__(self, key): @@ -178,36 +296,32 @@ class tdb(object): -tdb.error = new_instancemethod(_tdb.tdb_error,None,tdb) -tdb.close = new_instancemethod(_tdb.tdb_close,None,tdb) -tdb.append = new_instancemethod(_tdb.tdb_append,None,tdb) -tdb.errorstr = new_instancemethod(_tdb.tdb_errorstr,None,tdb) -tdb.get = new_instancemethod(_tdb.tdb_get,None,tdb) -tdb.delete = new_instancemethod(_tdb.tdb_delete,None,tdb) -tdb.store = new_instancemethod(_tdb.tdb_store,None,tdb) -tdb.exists = new_instancemethod(_tdb.tdb_exists,None,tdb) -tdb.firstkey = new_instancemethod(_tdb.tdb_firstkey,None,tdb) -tdb.nextkey = new_instancemethod(_tdb.tdb_nextkey,None,tdb) -tdb.lock_all = new_instancemethod(_tdb.tdb_lock_all,None,tdb) -tdb.unlock_all = new_instancemethod(_tdb.tdb_unlock_all,None,tdb) -tdb.read_lock_all = new_instancemethod(_tdb.tdb_read_lock_all,None,tdb) -tdb.read_unlock_all = new_instancemethod(_tdb.tdb_read_unlock_all,None,tdb) -tdb.reopen = new_instancemethod(_tdb.tdb_reopen,None,tdb) -tdb.transaction_start = new_instancemethod(_tdb.tdb_transaction_start,None,tdb) -tdb.transaction_commit = new_instancemethod(_tdb.tdb_transaction_commit,None,tdb) -tdb.transaction_cancel = new_instancemethod(_tdb.tdb_transaction_cancel,None,tdb) -tdb.transaction_recover = new_instancemethod(_tdb.tdb_transaction_recover,None,tdb) -tdb.hash_size = new_instancemethod(_tdb.tdb_hash_size,None,tdb) -tdb.map_size = new_instancemethod(_tdb.tdb_map_size,None,tdb) -tdb.get_flags = new_instancemethod(_tdb.tdb_get_flags,None,tdb) -tdb.set_max_dead = new_instancemethod(_tdb.tdb_set_max_dead,None,tdb) -tdb.name = new_instancemethod(_tdb.tdb_name,None,tdb) -tdb_swigregister = _tdb.tdb_swigregister -tdb_swigregister(tdb) - -def Tdb(*args, **kwargs): - val = _tdb.new_Tdb(*args, **kwargs) - return val +Tdb.error = new_instancemethod(_tdb.Tdb_error,None,Tdb) +Tdb.close = new_instancemethod(_tdb.Tdb_close,None,Tdb) +Tdb.append = new_instancemethod(_tdb.Tdb_append,None,Tdb) +Tdb.errorstr = new_instancemethod(_tdb.Tdb_errorstr,None,Tdb) +Tdb.get = new_instancemethod(_tdb.Tdb_get,None,Tdb) +Tdb.delete = new_instancemethod(_tdb.Tdb_delete,None,Tdb) +Tdb.store = new_instancemethod(_tdb.Tdb_store,None,Tdb) +Tdb.exists = new_instancemethod(_tdb.Tdb_exists,None,Tdb) +Tdb.firstkey = new_instancemethod(_tdb.Tdb_firstkey,None,Tdb) +Tdb.nextkey = new_instancemethod(_tdb.Tdb_nextkey,None,Tdb) +Tdb.lock_all = new_instancemethod(_tdb.Tdb_lock_all,None,Tdb) +Tdb.unlock_all = new_instancemethod(_tdb.Tdb_unlock_all,None,Tdb) +Tdb.read_lock_all = new_instancemethod(_tdb.Tdb_read_lock_all,None,Tdb) +Tdb.read_unlock_all = new_instancemethod(_tdb.Tdb_read_unlock_all,None,Tdb) +Tdb.reopen = new_instancemethod(_tdb.Tdb_reopen,None,Tdb) +Tdb.transaction_start = new_instancemethod(_tdb.Tdb_transaction_start,None,Tdb) +Tdb.transaction_commit = new_instancemethod(_tdb.Tdb_transaction_commit,None,Tdb) +Tdb.transaction_cancel = new_instancemethod(_tdb.Tdb_transaction_cancel,None,Tdb) +Tdb.transaction_recover = new_instancemethod(_tdb.Tdb_transaction_recover,None,Tdb) +Tdb.hash_size = new_instancemethod(_tdb.Tdb_hash_size,None,Tdb) +Tdb.map_size = new_instancemethod(_tdb.Tdb_map_size,None,Tdb) +Tdb.get_flags = new_instancemethod(_tdb.Tdb_get_flags,None,Tdb) +Tdb.set_max_dead = new_instancemethod(_tdb.Tdb_set_max_dead,None,Tdb) +Tdb.name = new_instancemethod(_tdb.Tdb_name,None,Tdb) +Tdb_swigregister = _tdb.Tdb_swigregister +Tdb_swigregister(Tdb) diff --git a/source4/lib/tdb/tdb_wrap.c b/source4/lib/tdb/tdb_wrap.c index 6a5b7feffc..27da552d33 100644 --- a/source4/lib/tdb/tdb_wrap.c +++ b/source4/lib/tdb/tdb_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -126,7 +126,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -161,6 +161,7 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_Format(PyExc_RuntimeError, mesg); + PyErr_SetString(PyExc_RuntimeError, mesg); } } @@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v) { PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own) { + if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; @@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } else { - const char *name = SWIG_TypePrettyName(ty); + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); -#endif + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } +#endif } Py_XDECREF(next); PyObject_DEL(v); @@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { + if (own == SWIG_POINTER_OWN) { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; @@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } else { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (!tc) { sobj = (PySwigObject *)sobj->next; } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } break; } } @@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) *own = sobj->own; + if (own) + *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } } else { *ptr = vptr; } @@ -2500,7 +2518,7 @@ static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0}; #define SWIG_name "_tdb" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -2874,7 +2892,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; enum TDB_ERROR result; @@ -2886,7 +2904,7 @@ SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *a swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_error" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_error" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (enum TDB_ERROR)tdb_error(arg1); @@ -2897,7 +2915,7 @@ fail: } -SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_delete_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; void *argp1 = 0 ; @@ -2908,7 +2926,7 @@ SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject * swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_tdb" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Tdb" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); delete_tdb(arg1); @@ -2920,7 +2938,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -2932,7 +2950,7 @@ SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *a swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_close" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_close" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_close(arg1); @@ -2943,7 +2961,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -2958,10 +2976,10 @@ SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "key",(char *) "new_dbuf", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_append" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_append" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -2992,7 +3010,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; char *result = 0 ; @@ -3004,7 +3022,7 @@ SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_errorstr" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_errorstr" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (char *)tdb_errorstr(arg1); @@ -3015,7 +3033,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3028,10 +3046,10 @@ SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *arg (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_get",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_get",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3057,7 +3075,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3070,10 +3088,10 @@ SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_delete" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_delete" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3094,7 +3112,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3114,10 +3132,10 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a }; arg4 = TDB_REPLACE; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_store" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_store" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3143,7 +3161,7 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a if (obj3) { ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "tdb_store" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Tdb_store" "', argument " "4"" of type '" "int""'"); } arg4 = (int)(val4); } @@ -3155,7 +3173,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3168,10 +3186,10 @@ SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_exists" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_exists" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3192,7 +3210,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA result; @@ -3204,7 +3222,7 @@ SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_firstkey" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_firstkey" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = tdb_firstkey(arg1); @@ -3220,7 +3238,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3233,10 +3251,10 @@ SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_nextkey" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_nextkey" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3262,7 +3280,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3274,7 +3292,7 @@ SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_lock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_lock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_lockall(arg1); @@ -3285,7 +3303,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3297,7 +3315,7 @@ SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObje swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_unlockall(arg1); @@ -3308,7 +3326,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3320,7 +3338,7 @@ SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyO swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_lockall_read(arg1); @@ -3331,7 +3349,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3343,7 +3361,7 @@ SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), P swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_unlockall_read(arg1); @@ -3354,7 +3372,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3366,7 +3384,7 @@ SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject * swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_reopen" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_reopen" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_reopen(arg1); @@ -3377,7 +3395,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3389,7 +3407,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_start(arg1); @@ -3400,7 +3418,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3412,7 +3430,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self) swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_commit(arg1); @@ -3423,7 +3441,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3435,7 +3453,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self) swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_cancel(arg1); @@ -3446,7 +3464,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3458,7 +3476,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_recover(arg1); @@ -3469,7 +3487,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3481,7 +3499,7 @@ SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObjec swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_hash_size" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_hash_size" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_hash_size(arg1); @@ -3492,7 +3510,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; size_t result; @@ -3504,7 +3522,7 @@ SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_map_size" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_map_size" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = tdb_map_size(arg1); @@ -3515,7 +3533,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3527,7 +3545,7 @@ SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObjec swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get_flags" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get_flags" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_get_flags(arg1); @@ -3538,7 +3556,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int arg2 ; @@ -3552,15 +3570,15 @@ SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyOb (char *) "self",(char *) "max_dead", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tdb_set_max_dead" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Tdb_set_max_dead" "', argument " "2"" of type '" "int""'"); } arg2 = (int)(val2); tdb_set_max_dead(arg1,arg2); @@ -3571,7 +3589,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; char *result = 0 ; @@ -3583,7 +3601,7 @@ SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *ar swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_name" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_name" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (char *)tdb_name(arg1); @@ -3594,41 +3612,85 @@ fail: } -SWIGINTERN PyObject *tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *Tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_tdb_context, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *Tdb_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + static PyMethodDef SwigMethods[] = { - { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_error", (PyCFunction)_wrap_tdb_error, METH_O, NULL}, - { (char *)"delete_tdb", (PyCFunction)_wrap_delete_tdb, METH_O, NULL}, - { (char *)"tdb_close", (PyCFunction)_wrap_tdb_close, METH_O, NULL}, - { (char *)"tdb_append", (PyCFunction) _wrap_tdb_append, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_errorstr", (PyCFunction)_wrap_tdb_errorstr, METH_O, NULL}, - { (char *)"tdb_get", (PyCFunction) _wrap_tdb_get, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_delete", (PyCFunction) _wrap_tdb_delete, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_store", (PyCFunction) _wrap_tdb_store, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_exists", (PyCFunction) _wrap_tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_firstkey", (PyCFunction)_wrap_tdb_firstkey, METH_O, NULL}, - { (char *)"tdb_nextkey", (PyCFunction) _wrap_tdb_nextkey, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_lock_all", (PyCFunction)_wrap_tdb_lock_all, METH_O, NULL}, - { (char *)"tdb_unlock_all", (PyCFunction)_wrap_tdb_unlock_all, METH_O, NULL}, - { (char *)"tdb_read_lock_all", (PyCFunction)_wrap_tdb_read_lock_all, METH_O, NULL}, - { (char *)"tdb_read_unlock_all", (PyCFunction)_wrap_tdb_read_unlock_all, METH_O, NULL}, - { (char *)"tdb_reopen", (PyCFunction)_wrap_tdb_reopen, METH_O, NULL}, - { (char *)"tdb_transaction_start", (PyCFunction)_wrap_tdb_transaction_start, METH_O, NULL}, - { (char *)"tdb_transaction_commit", (PyCFunction)_wrap_tdb_transaction_commit, METH_O, NULL}, - { (char *)"tdb_transaction_cancel", (PyCFunction)_wrap_tdb_transaction_cancel, METH_O, NULL}, - { (char *)"tdb_transaction_recover", (PyCFunction)_wrap_tdb_transaction_recover, METH_O, NULL}, - { (char *)"tdb_hash_size", (PyCFunction)_wrap_tdb_hash_size, METH_O, NULL}, - { (char *)"tdb_map_size", (PyCFunction)_wrap_tdb_map_size, METH_O, NULL}, - { (char *)"tdb_get_flags", (PyCFunction)_wrap_tdb_get_flags, METH_O, NULL}, - { (char *)"tdb_set_max_dead", (PyCFunction) _wrap_tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_name", (PyCFunction)_wrap_tdb_name, METH_O, NULL}, - { (char *)"tdb_swigregister", tdb_swigregister, METH_VARARGS, NULL}, + { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n" + "Open a TDB file.\n" + ""}, + { (char *)"Tdb_error", (PyCFunction)_wrap_Tdb_error, METH_O, NULL}, + { (char *)"delete_Tdb", (PyCFunction)_wrap_delete_Tdb, METH_O, NULL}, + { (char *)"Tdb_close", (PyCFunction)_wrap_Tdb_close, METH_O, (char *)"\n" + "S.close() -> None\n" + "Close the TDB file.\n" + ""}, + { (char *)"Tdb_append", (PyCFunction) _wrap_Tdb_append, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Tdb_errorstr", (PyCFunction)_wrap_Tdb_errorstr, METH_O, (char *)"\n" + "S.errorstr() -> errorstring\n" + "Obtain last error message.\n" + ""}, + { (char *)"Tdb_get", (PyCFunction) _wrap_Tdb_get, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.fetch(key) -> value\n" + "Fetch a value.\n" + ""}, + { (char *)"Tdb_delete", (PyCFunction) _wrap_Tdb_delete, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.delete(key) -> None\n" + "Delete an entry.\n" + ""}, + { (char *)"Tdb_store", (PyCFunction) _wrap_Tdb_store, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.store(key, value, flag=TDB_REPLACE) -> None\n" + "Store an entry.\n" + ""}, + { (char *)"Tdb_exists", (PyCFunction) _wrap_Tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Tdb_firstkey", (PyCFunction)_wrap_Tdb_firstkey, METH_O, (char *)"\n" + "S.firstkey() -> data\n" + "Return the first key in this database.\n" + ""}, + { (char *)"Tdb_nextkey", (PyCFunction) _wrap_Tdb_nextkey, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.nextkey(prev) -> data\n" + "Return the next key in this database.\n" + ""}, + { (char *)"Tdb_lock_all", (PyCFunction)_wrap_Tdb_lock_all, METH_O, (char *)"S.lockall() -> bool"}, + { (char *)"Tdb_unlock_all", (PyCFunction)_wrap_Tdb_unlock_all, METH_O, (char *)"S.unlockall() -> bool"}, + { (char *)"Tdb_read_lock_all", (PyCFunction)_wrap_Tdb_read_lock_all, METH_O, NULL}, + { (char *)"Tdb_read_unlock_all", (PyCFunction)_wrap_Tdb_read_unlock_all, METH_O, NULL}, + { (char *)"Tdb_reopen", (PyCFunction)_wrap_Tdb_reopen, METH_O, (char *)"\n" + "S.reopen() -> bool\n" + "Reopen this file.\n" + ""}, + { (char *)"Tdb_transaction_start", (PyCFunction)_wrap_Tdb_transaction_start, METH_O, (char *)"\n" + "S.transaction_start() -> None\n" + "Start a new transaction.\n" + ""}, + { (char *)"Tdb_transaction_commit", (PyCFunction)_wrap_Tdb_transaction_commit, METH_O, (char *)"\n" + "S.transaction_commit() -> None\n" + "Commit the currently active transaction.\n" + ""}, + { (char *)"Tdb_transaction_cancel", (PyCFunction)_wrap_Tdb_transaction_cancel, METH_O, (char *)"\n" + "S.transaction_cancel() -> None\n" + "Cancel the currently active transaction.\n" + ""}, + { (char *)"Tdb_transaction_recover", (PyCFunction)_wrap_Tdb_transaction_recover, METH_O, NULL}, + { (char *)"Tdb_hash_size", (PyCFunction)_wrap_Tdb_hash_size, METH_O, (char *)"S.hash_size() -> int"}, + { (char *)"Tdb_map_size", (PyCFunction)_wrap_Tdb_map_size, METH_O, (char *)"S.map_size() -> int"}, + { (char *)"Tdb_get_flags", (PyCFunction)_wrap_Tdb_get_flags, METH_O, (char *)"S.get_flags() -> int"}, + { (char *)"Tdb_set_max_dead", (PyCFunction) _wrap_Tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, (char *)"S.set_max_dead(int) -> None"}, + { (char *)"Tdb_name", (PyCFunction)_wrap_Tdb_name, METH_O, (char *)"\n" + "S.name() -> path\n" + "Return filename of this TDB file.\n" + ""}, + { (char *)"Tdb_swigregister", Tdb_swigregister, METH_VARARGS, NULL}, + { (char *)"Tdb_swiginit", Tdb_swiginit, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; @@ -3753,7 +3815,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -3763,6 +3825,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -3791,6 +3856,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); |