From 5fea33ab589efea509079f01c09d84f66d891537 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 10 Dec 2001 05:05:21 +0000 Subject: tdb_open_ex: Continue previous refactoring so that we consistently just say "tdb" not "&tdb". (This used to be commit fac685d30f58c25d73d1690ed008c797291558e4) --- source3/tdb/tdb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/tdb') 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); -- cgit