mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
removed the state parameter to tdb_traverse and the TDB_MODIFY flag
(This used to be commit 6505efc7e9
)
This commit is contained in:
parent
83b9f88e26
commit
4217c609a8
@ -2,7 +2,6 @@
|
||||
Unix SMB/CIFS implementation.
|
||||
Samba database functions
|
||||
Copyright (C) Andrew Tridgell 1999-2000
|
||||
Copyright (C) Luke Kenneth Casson Leighton 2000
|
||||
Copyright (C) Paul `Rusty' Russell 2000
|
||||
Copyright (C) Jeremy Allison 2000-2003
|
||||
|
||||
@ -1293,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, void *state)
|
||||
int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn)
|
||||
{
|
||||
TDB_DATA key, dbuf;
|
||||
struct list_struct rec;
|
||||
@ -1331,7 +1330,7 @@ int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state)
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
if (fn && fn(tdb, key, dbuf, state)) {
|
||||
if (fn && fn(tdb, key, dbuf)) {
|
||||
/* They want us to terminate traversal */
|
||||
ret = count;
|
||||
if (unlock_record(tdb, tl.off) != 0) {
|
||||
@ -1480,8 +1479,6 @@ int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
|
||||
/* first try in-place update, on modify or replace. */
|
||||
if (tdb_update_hash(tdb, key, hash, dbuf) == 0)
|
||||
goto out;
|
||||
if (flag == TDB_MODIFY && tdb->ecode == TDB_ERR_NOEXIST)
|
||||
goto fail;
|
||||
}
|
||||
/* reset the error code potentially set by the tdb_update() */
|
||||
tdb->ecode = TDB_SUCCESS;
|
||||
@ -1504,9 +1501,7 @@ int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
|
||||
if (dbuf.dsize)
|
||||
memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize);
|
||||
|
||||
/* now we're into insert / modify / replace of a record which
|
||||
* we know could not be optimised by an in-place store (for
|
||||
* various reasons). */
|
||||
/* we have to allocate some space */
|
||||
if (!(rec_ptr = tdb_allocate(tdb, key.dsize + dbuf.dsize, &rec)))
|
||||
goto fail;
|
||||
|
||||
|
@ -29,7 +29,6 @@ extern "C" {
|
||||
/* flags to tdb_store() */
|
||||
#define TDB_REPLACE 1
|
||||
#define TDB_INSERT 2
|
||||
#define TDB_MODIFY 3
|
||||
|
||||
/* flags for tdb_open() */
|
||||
#define TDB_DEFAULT 0 /* just a readability place holder */
|
||||
@ -44,7 +43,8 @@ extern "C" {
|
||||
|
||||
/* error codes */
|
||||
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
|
||||
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOEXIST, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT };
|
||||
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT,
|
||||
TDB_ERR_NOEXIST};
|
||||
|
||||
#ifndef u32
|
||||
#define u32 unsigned
|
||||
@ -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, void *);
|
||||
typedef int (*tdb_traverse_func)(TDB_CONTEXT *, TDB_DATA, TDB_DATA);
|
||||
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, void *state);
|
||||
int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user