summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-12-10 05:05:21 +0000
committerMartin Pool <mbp@samba.org>2001-12-10 05:05:21 +0000
commit5fea33ab589efea509079f01c09d84f66d891537 (patch)
treeec5c3a549c2aebfab845e044c6d3605f2aaf36b8
parent4f53486d78102d8080293eeafd7b4ed701d81a2e (diff)
downloadsamba-5fea33ab589efea509079f01c09d84f66d891537.tar.gz
samba-5fea33ab589efea509079f01c09d84f66d891537.tar.bz2
samba-5fea33ab589efea509079f01c09d84f66d891537.zip
tdb_open_ex: Continue previous refactoring so that we consistently
just say "tdb" not "&tdb". (This used to be commit fac685d30f58c25d73d1690ed008c797291558e4)
-rw-r--r--source3/tdb/tdb.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index f5e419bac0..f78d4e2bb1 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1419,7 +1419,7 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
if (tdb->flags & TDB_INTERNAL) {
tdb->flags |= (TDB_NOLOCK | TDB_NOMMAP);
tdb->flags &= ~TDB_CLEAR_IF_FIRST;
- tdb_new_database(&tdb[0], hash_size);
+ tdb_new_database(tdb, hash_size);
goto internal;
}
@@ -1427,11 +1427,11 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
goto fail; /* errno set by open(2) */
/* ensure there is only one process initialising at once */
- if (tdb_brlock(&tdb[0], GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0) == -1)
+ if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0) == -1)
goto fail; /* errno set by tdb_brlock */
/* we need to zero database if we are the only one with it open */
- if ((locked = (tdb_brlock(&tdb[0], ACTIVE_LOCK, F_WRLCK, F_SETLK, 0) == 0))
+ if ((locked = (tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0) == 0))
&& (tdb_flags & TDB_CLEAR_IF_FIRST)) {
open_flags |= O_CREAT;
if (ftruncate(tdb->fd, 0) == -1)
@@ -1443,7 +1443,7 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
|| (tdb->header.version != TDB_VERSION
&& !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) {
/* its not a valid database - possibly initialise it */
- if (!(open_flags & O_CREAT) || tdb_new_database(&tdb[0], hash_size) == -1) {
+ if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) {
errno = EIO; /* ie bad format or something */
goto fail;
}
@@ -1481,24 +1481,24 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
errno = ENOMEM;
goto fail;
}
- tdb_mmap(&tdb[0]);
+ tdb_mmap(tdb);
if (locked) {
if (!tdb->read_only)
- tdb_clear_spinlocks(&tdb[0]);
- if (tdb_brlock(&tdb[0], ACTIVE_LOCK, F_UNLCK, F_SETLK, 0) == -1)
+ tdb_clear_spinlocks(tdb);
+ if (tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0) == -1)
goto fail;
}
/* leave this lock in place to indicate it's in use */
- if (tdb_brlock(&tdb[0], ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)
+ if (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)
goto fail;
internal:
- if (!(ret = malloc(sizeof(tdb[0])))) {
+ if (!(ret = malloc(sizeof(*tdb)))) {
errno = ENOMEM;
goto fail;
}
- *ret = tdb[0];
- if (tdb_brlock(&tdb[0], GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0) == -1)
+ *ret = *tdb;
+ if (tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0) == -1)
goto fail;
ret->next = tdbs;
tdbs = ret;
@@ -1511,7 +1511,7 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
if (tdb->flags & TDB_INTERNAL)
free(tdb->map_ptr);
else
- tdb_munmap(&tdb[0]);
+ tdb_munmap(tdb);
}
if (tdb->name)
free(tdb->name);