diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-03-28 01:33:32 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2004-03-28 01:33:32 +0000 |
commit | 2fe43ec90f6c76ced5e697f4a26630bd72accdc5 (patch) | |
tree | 7f51a6434a5486e4d3a2691ba6ed3ab16d5c96c7 | |
parent | 4217c609a8c932967aa2641c5e24dde413efb575 (diff) | |
download | samba-2fe43ec90f6c76ced5e697f4a26630bd72accdc5.tar.gz samba-2fe43ec90f6c76ced5e697f4a26630bd72accdc5.tar.xz samba-2fe43ec90f6c76ced5e697f4a26630bd72accdc5.zip |
added a private pointer to tdb_traverse() to allow callers to supply
data to their traverse function
(This used to be commit 76bf816485bf869c293791659da5dff2425d2d32)
-rw-r--r-- | source4/lib/tdb/tdb.c | 4 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source4/lib/tdb/tdb.c b/source4/lib/tdb/tdb.c index 1fef5d54fa9..8fbf1289146 100644 --- a/source4/lib/tdb/tdb.c +++ b/source4/lib/tdb/tdb.c @@ -1292,7 +1292,7 @@ static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock, 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, tdb_traverse_func fn) +int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *private) { TDB_DATA key, dbuf; struct list_struct rec; @@ -1330,7 +1330,7 @@ int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn) ret = -1; goto out; } - if (fn && fn(tdb, key, dbuf)) { + if (fn && fn(tdb, key, dbuf, private)) { /* They want us to terminate traversal */ ret = count; if (unlock_record(tdb, tl.off) != 0) { diff --git a/source4/lib/tdb/tdb.h b/source4/lib/tdb/tdb.h index d20f4cd677c..b3a28b7440e 100644 --- a/source4/lib/tdb/tdb.h +++ b/source4/lib/tdb/tdb.h @@ -98,7 +98,7 @@ typedef struct tdb_context { int open_flags; /* flags used in the open - needed by reopen */ } TDB_CONTEXT; -typedef int (*tdb_traverse_func)(TDB_CONTEXT *, TDB_DATA, TDB_DATA); +typedef int (*tdb_traverse_func)(TDB_CONTEXT *, TDB_DATA, TDB_DATA, void *); typedef void (*tdb_log_func)(TDB_CONTEXT *, int , const char *, ...); TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags, @@ -119,7 +119,7 @@ int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf); int tdb_close(TDB_CONTEXT *tdb); TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn); +int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *); int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]); void tdb_unlockkeys(TDB_CONTEXT *tdb); |