summaryrefslogtreecommitdiff
path: root/source4/lib/tdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r--source4/lib/tdb/tdb.i16
-rw-r--r--source4/lib/tdb/tdb_wrap.c152
2 files changed, 68 insertions, 100 deletions
diff --git a/source4/lib/tdb/tdb.i b/source4/lib/tdb/tdb.i
index 03b71fa586..5bb6506d93 100644
--- a/source4/lib/tdb/tdb.i
+++ b/source4/lib/tdb/tdb.i
@@ -49,7 +49,7 @@ typedef TDB_CONTEXT tdb;
%import exception.i
%import stdint.i
-%typemap(check) TDB_CONTEXT* {
+%typemap(check,noblock=1) TDB_CONTEXT* {
if ($1 == NULL)
SWIG_exception(SWIG_ValueError,
"tdb context must be non-NULL");
@@ -59,7 +59,7 @@ typedef TDB_CONTEXT tdb;
and from the Python string type which can contain arbitrary binary
data.. */
-%typemap(in) TDB_DATA {
+%typemap(in,noblock=1) TDB_DATA {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
@@ -68,7 +68,7 @@ typedef TDB_CONTEXT tdb;
$1.dptr = (uint8_t *)PyString_AsString($input);
}
-%typemap(out) TDB_DATA {
+%typemap(out,noblock=1) TDB_DATA {
if ($1.dptr == NULL && $1.dsize == 0) {
$result = Py_None;
} else {
@@ -115,23 +115,23 @@ enum TDB_ERROR {
%rename(read_lock_all) tdb_context::lockall_read;
%rename(read_unlock_all) tdb_context::unlockall_read;
-%typemap(default) int tdb_flags {
+%typemap(default,noblock=1) int tdb_flags {
$1 = TDB_DEFAULT;
}
-%typemap(default) int open_flags {
+%typemap(default,noblock=1) int open_flags {
$1 = O_RDWR;
}
-%typemap(default) int hash_size {
+%typemap(default,noblock=1) int hash_size {
$1 = 0;
}
-%typemap(default) mode_t mode {
+%typemap(default,noblock=1) mode_t mode {
$1 = 0600;
}
-%typemap(default) int flag {
+%typemap(default,noblock=1) int flag {
$1 = TDB_REPLACE;
}
diff --git a/source4/lib/tdb/tdb_wrap.c b/source4/lib/tdb/tdb_wrap.c
index 841cd78399..1ba7481af0 100644
--- a/source4/lib/tdb/tdb_wrap.c
+++ b/source4/lib/tdb/tdb_wrap.c
@@ -2831,18 +2831,10 @@ SWIGINTERN PyObject *_wrap_new_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
(char *) "name",(char *) "hash_size",(char *) "tdb_flags",(char *) "open_flags",(char *) "mode", NULL
};
- {
- arg2 = 0;
- }
- {
- arg3 = TDB_DEFAULT;
- }
- {
- arg4 = O_RDWR;
- }
- {
- arg5 = 0600;
- }
+ arg2 = 0;
+ arg3 = TDB_DEFAULT;
+ arg4 = O_RDWR;
+ arg5 = 0600;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:new_Tdb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
@@ -2977,22 +2969,18 @@ SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_append" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
- {
- if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj1)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
- {
- if (!PyString_Check(obj2)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg3)->dsize = PyString_Size(obj2);
- (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
+ (&arg2)->dsize = PyString_Size(obj1);
+ (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj2)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
+ (&arg3)->dsize = PyString_Size(obj2);
+ (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
result = (int)tdb_append(arg1,arg2,arg3);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@@ -3043,22 +3031,18 @@ SWIGINTERN PyObject *_wrap_tdb_fetch(PyObject *SWIGUNUSEDPARM(self), PyObject *a
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_fetch" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
- {
- if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj1)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
+ (&arg2)->dsize = PyString_Size(obj1);
+ (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = tdb_fetch(arg1,arg2);
- {
- if ((&result)->dptr == NULL && (&result)->dsize == 0) {
- resultobj = Py_None;
- } else {
- resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
- free((&result)->dptr);
- }
+ if ((&result)->dptr == NULL && (&result)->dsize == 0) {
+ resultobj = Py_None;
+ } else {
+ resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
+ free((&result)->dptr);
}
return resultobj;
fail:
@@ -3085,14 +3069,12 @@ SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_delete" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
- {
- if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj1)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
+ (&arg2)->dsize = PyString_Size(obj1);
+ (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = (int)tdb_delete(arg1,arg2);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@@ -3120,31 +3102,25 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a
(char *) "self",(char *) "key",(char *) "dbuf",(char *) "flag", NULL
};
- {
- arg4 = TDB_REPLACE;
- }
+ arg4 = TDB_REPLACE;
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 *""'");
}
arg1 = (tdb *)(argp1);
- {
- if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj1)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
- {
- if (!PyString_Check(obj2)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg3)->dsize = PyString_Size(obj2);
- (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
+ (&arg2)->dsize = PyString_Size(obj1);
+ (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj2)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
+ (&arg3)->dsize = PyString_Size(obj2);
+ (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
if (obj3) {
ecode4 = SWIG_AsVal_int(obj3, &val4);
if (!SWIG_IsOK(ecode4)) {
@@ -3179,14 +3155,12 @@ SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_exists" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
- {
- if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj1)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
+ (&arg2)->dsize = PyString_Size(obj1);
+ (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = (int)tdb_exists(arg1,arg2);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@@ -3211,13 +3185,11 @@ SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject
}
arg1 = (tdb *)(argp1);
result = tdb_firstkey(arg1);
- {
- if ((&result)->dptr == NULL && (&result)->dsize == 0) {
- resultobj = Py_None;
- } else {
- resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
- free((&result)->dptr);
- }
+ if ((&result)->dptr == NULL && (&result)->dsize == 0) {
+ resultobj = Py_None;
+ } else {
+ resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
+ free((&result)->dptr);
}
return resultobj;
fail:
@@ -3244,22 +3216,18 @@ SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_nextkey" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
- {
- if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- }
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
+ if (!PyString_Check(obj1)) {
+ PyErr_SetString(PyExc_TypeError, "string arg expected");
+ return NULL;
}
+ (&arg2)->dsize = PyString_Size(obj1);
+ (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = tdb_nextkey(arg1,arg2);
- {
- if ((&result)->dptr == NULL && (&result)->dsize == 0) {
- resultobj = Py_None;
- } else {
- resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
- free((&result)->dptr);
- }
+ if ((&result)->dptr == NULL && (&result)->dsize == 0) {
+ resultobj = Py_None;
+ } else {
+ resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
+ free((&result)->dptr);
}
return resultobj;
fail: