summaryrefslogtreecommitdiff
path: root/lib/tdb2/traverse.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:55:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:55:13 +0930
commit30294c7b91456dd49b89a9b26eb0b1066087815c (patch)
tree8bf72d6834fafb9e030d120e7f6c881068cdb3af /lib/tdb2/traverse.c
parente6cbc0f00ec9ecb4c014ee484746d565382d5f67 (diff)
downloadsamba-30294c7b91456dd49b89a9b26eb0b1066087815c.tar.gz
samba-30294c7b91456dd49b89a9b26eb0b1066087815c.tar.bz2
samba-30294c7b91456dd49b89a9b26eb0b1066087815c.zip
tdb2: unify tdb1_traverse into tdb_traverse
Switch on the TDB_VERSION1 flag; we now only do a tdb1_traverse_read on a read-only database, as there is no tdb2 equivalent. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit cc2d609dfca7192305ad477b8c2b52cfdc1aa9be)
Diffstat (limited to 'lib/tdb2/traverse.c')
-rw-r--r--lib/tdb2/traverse.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/tdb2/traverse.c b/lib/tdb2/traverse.c
index 179e095142..a065ad0042 100644
--- a/lib/tdb2/traverse.c
+++ b/lib/tdb2/traverse.c
@@ -28,6 +28,13 @@ int64_t tdb_traverse_(struct tdb_context *tdb,
struct tdb_data k, d;
int64_t count = 0;
+ if (tdb->flags & TDB_VERSION1) {
+ count = tdb1_traverse(tdb, fn, p);
+ if (count == -1)
+ return tdb->last_error;
+ return count;
+ }
+
k.dptr = NULL;
for (ecode = first_in_hash(tdb, &tinfo, &k, &d.dsize);
ecode == TDB_SUCCESS;