summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-25 14:18:08 +0100
committerMichael Adam <obnox@samba.org>2008-03-25 15:55:34 +0100
commitaaa59713155b63b2597f955622be9019bb3cbe89 (patch)
tree387265c33a331aa940f4f1984f2b2fd67c594b54 /source3
parent2d02e5a16d53072a73d0d864da9b90dd3dad994a (diff)
downloadsamba-aaa59713155b63b2597f955622be9019bb3cbe89.tar.gz
samba-aaa59713155b63b2597f955622be9019bb3cbe89.tar.xz
samba-aaa59713155b63b2597f955622be9019bb3cbe89.zip
util_tdb: add a wrapper tdb_wipe() for traverse with tdb_traverse_delete_fn().
Replace all callers of traverse with this tdb_traverse_delete_fn() and don't export tdb_traverse_delete_fn() anymore. Michael (This used to be commit d4be4e30cd8c3bdc303da30e42280f892a45a8c9)
Diffstat (limited to 'source3')
-rw-r--r--source3/groupdb/mapping_tdb.c2
-rw-r--r--source3/include/util_tdb.h3
-rw-r--r--source3/intl/lang_tdb.c2
-rw-r--r--source3/lib/sharesec.c2
-rw-r--r--source3/lib/util_tdb.c10
-rw-r--r--source3/printing/printing.c2
6 files changed, 13 insertions, 8 deletions
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index c9c8cdcaeb..6732e3c42e 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -76,7 +76,7 @@ static bool init_group_mapping(void)
/* if its an unknown version we remove everthing in the db */
if (vers_id != DATABASE_VERSION_V2) {
- tdb_traverse(tdb, tdb_traverse_delete_fn, NULL);
+ tdb_wipe(tdb);
tdb_store_int32(tdb, vstring, DATABASE_VERSION_V2);
}
diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h
index 4ed791b69b..0a8eb935a3 100644
--- a/source3/include/util_tdb.h
+++ b/source3/include/util_tdb.h
@@ -73,8 +73,7 @@ int32 tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32
bool tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr,
uint32 *oldval, uint32 change_val);
-int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA dbuf,
- void *state);
+int tdb_wipe(TDB_CONTEXT *tdb);
int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags);
int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr,
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c
index 6ad9ef8496..4e4a3a5e20 100644
--- a/source3/intl/lang_tdb.c
+++ b/source3/intl/lang_tdb.c
@@ -45,7 +45,7 @@ static bool load_msg(const char *msg_file)
}
/* wipe the db */
- tdb_traverse(tdb, tdb_traverse_delete_fn, NULL);
+ tdb_wipe(tdb);
msgid = NULL;
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index f6ff701d5b..60f6e5077b 100644
--- a/source3/lib/sharesec.c
+++ b/source3/lib/sharesec.c
@@ -65,7 +65,7 @@ static bool share_info_db_init(void)
}
if (vers_id != SHARE_DATABASE_VERSION_V2) {
- tdb_traverse(share_tdb, tdb_traverse_delete_fn, NULL);
+ tdb_wipe(share_tdb);
tdb_store_int32(share_tdb, vstring, SHARE_DATABASE_VERSION_V2);
}
tdb_unlock_bystring(share_tdb, vstring);
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index 4ecb4d5b81..4332a7948f 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -722,12 +722,18 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags,
Allow tdb_delete to be used as a tdb_traversal_fn.
****************************************************************************/
-int tdb_traverse_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf,
- void *state)
+static int tdb_traverse_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
+ TDB_DATA dbuf, void *state)
{
return tdb_delete(the_tdb, key);
}
+int tdb_wipe(TDB_CONTEXT *tdb)
+{
+ return tdb_traverse(tdb, tdb_traverse_delete_fn, NULL);
+}
+
+
/**
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 221e79b337..c9736b70bb 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -202,7 +202,7 @@ bool print_backend_init(struct messaging_context *msg_ctx)
return False;
}
if (tdb_fetch_int32(pdb->tdb, sversion) != PRINT_DATABASE_VERSION) {
- tdb_traverse(pdb->tdb, tdb_traverse_delete_fn, NULL);
+ tdb_wipe(pdb->tdb);
tdb_store_int32(pdb->tdb, sversion, PRINT_DATABASE_VERSION);
}
tdb_unlock_bystring(pdb->tdb, sversion);