summaryrefslogtreecommitdiff
path: root/source3/tdb/tdb.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>2000-02-04 04:59:31 +0000
committerLuke Leighton <lkcl@samba.org>2000-02-04 04:59:31 +0000
commitbbe275e95b86bc7af5a641455cbb379974823f84 (patch)
tree9dfa5cc96c8634b5a5810414109560fd5d4391b4 /source3/tdb/tdb.c
parentae7696117e81bb469fa71f9bc880f6b5aac0724e (diff)
downloadsamba-bbe275e95b86bc7af5a641455cbb379974823f84.tar.gz
samba-bbe275e95b86bc7af5a641455cbb379974823f84.tar.bz2
samba-bbe275e95b86bc7af5a641455cbb379974823f84.zip
1) added void* state argument to tdb_traverse. guess what! there were
two places i found where it was appropriate to _use_ that third argument, in locking.c and brlock.c! there was a static traverse_function and i removed the static variable, typecast it to a void*, passed it to tdb_traverse and re-cast it back to the traverse_function inside the tdb_traverse function. this makes the use of tdb_traverse() reentrant, which is never going to happen, i know, i just don't like to see statics lying about when there's no need for them. as i had to do in samba-tng, all uses of tdb_traverse modified to take the new void* state argument. 2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient. i don't know how the other samba team members would react if i deleted rpcclient from cvs main. damn, that code's so old, it's unreal. 20 rpcclient commands, instead of about 70 in SAMBA_TNG. (This used to be commit 49d7f0afbc1c5425d53019e234d54ddf205c8e9a)
Diffstat (limited to 'source3/tdb/tdb.c')
-rw-r--r--source3/tdb/tdb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index feb925d978..c469436f75 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -220,7 +220,7 @@ static int tdb_oob(TDB_CONTEXT *tdb, tdb_off offset)
/* write a lump of data at a specified offset */
-static int tdb_write(TDB_CONTEXT *tdb, tdb_off offset, char *buf, tdb_len len)
+static int tdb_write(TDB_CONTEXT *tdb, tdb_off offset, const char *buf, tdb_len len)
{
if (tdb_oob(tdb, offset + len) != 0) {
/* oops - trying to write beyond the end of the database! */
@@ -674,7 +674,7 @@ int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key)
if fn is NULL then it is not called
a non-zero return value from fn() indicates that the traversal should stop
*/
-int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf))
+int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void* state), void* state)
{
int count = 0;
unsigned h;
@@ -712,7 +712,7 @@ int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, TDB_DATA key, TDB
dbuf.dsize = rec.data_len;
count++;
- if (fn && fn(tdb, key, dbuf) != 0) {
+ if (fn && fn(tdb, key, dbuf, state) != 0) {
/* they want us to stop traversing */
free(data);
tdb_unlock(tdb, BUCKET(h));