tdb2: make tdb1_null static.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:34:13 +0000 (08:04 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:34:13 +0000 (08:04 +0930)
It's only used in two files, make it static in one and do it manually
in the other.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 8571daf007f03a2888566dbaae8a5849ffba60f3)

lib/tdb2/tdb1.h
lib/tdb2/tdb1_tdb.c
lib/tdb2/tdb1_traverse.c

index 6f23b6dd2bb834c3d91f9e828365ddf46ea2bce6..54b6d936d49b67de18aecd95b121a56ed616d977 100644 (file)
@@ -42,6 +42,4 @@ uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void
 
 /* @} ******************************************************************/
 
-extern TDB_DATA tdb1_null;
-
 #endif /* tdb1.h */
index 2442d34785e1d0e5ab032829b51c371671d2cf34..99b83ab72d08d7e6b733a1572063c9f8d240ca9d 100644 (file)
@@ -28,8 +28,6 @@
 #include "tdb1_private.h"
 #include <assert.h>
 
-TDB_DATA tdb1_null;
-
 /*
   non-blocking increment of the tdb sequence number if the tdb has been opened using
   the TDB_SEQNUM flag
@@ -191,8 +189,11 @@ static TDB_DATA _tdb1_fetch(struct tdb_context *tdb, TDB_DATA key)
 
        /* find which hash bucket it is in */
        hash = tdb_hash(tdb, key.dptr, key.dsize);
-       if (!(rec_ptr = tdb1_find_lock_hash(tdb,key,hash,F_RDLCK,&rec)))
-               return tdb1_null;
+       if (!(rec_ptr = tdb1_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) {
+               ret.dptr = NULL;
+               ret.dsize = 0;
+               return ret;
+       }
 
        ret.dptr = tdb1_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len,
                                  rec.data_len);
index 63052854d5428aef78b589667f5c51d3fc3ade3f..d9d3649fd96c9e8de53c4eb207119e8c33c46f2d 100644 (file)
@@ -29,6 +29,8 @@
 
 #define TDB1_NEXT_LOCK_ERR ((tdb1_off_t)-1)
 
+static TDB_DATA tdb1_null;
+
 /* Uses traverse lock: 0 = finish, TDB1_NEXT_LOCK_ERR = error,
    other = record offset */
 static tdb1_off_t tdb1_next_lock(struct tdb_context *tdb, struct tdb1_traverse_lock *tlock,