tdb2: fix prototypes which return enum TDB_ERROR.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 2 Sep 2011 06:06:47 +0000 (15:36 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 2 Sep 2011 06:06:47 +0000 (15:36 +0930)
Since enums and ints are compatible in C, the compiler didn't warn
that our prototypes for these functions disagreed with the
definitions.

ccan/tdb2/check.c
ccan/tdb2/private.h

index b3874c6d27b1b48256b748608a29d0e0b184a6e1..a8b5b3d558c04e2943912d77b7b558e3cd609499 100644 (file)
@@ -436,7 +436,7 @@ fail:
 static enum TDB_ERROR check_hash(struct tdb_context *tdb,
                                 tdb_off_t used[],
                                 size_t num_used, size_t num_ftables,
-                                int (*check)(TDB_DATA, TDB_DATA, void *),
+                                enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *),
                                 void *data)
 {
        /* Free tables also show up as used. */
index 26ca7b3081b279d5d5db07fadee5a712e3bdd27a..75e44ad8cb736f5505943eb898c671fafc9cfb2c 100644 (file)
@@ -342,13 +342,13 @@ struct tdb_methods {
 uint64_t tdb_jenkins_hash(const void *key, size_t length, uint64_t seed,
                          void *unused);
 
-tdb_bool_err first_in_hash(struct tdb_context *tdb,
-                          struct traverse_info *tinfo,
-                          TDB_DATA *kbuf, size_t *dlen);
+enum TDB_ERROR first_in_hash(struct tdb_context *tdb,
+                            struct traverse_info *tinfo,
+                            TDB_DATA *kbuf, size_t *dlen);
 
-tdb_bool_err next_in_hash(struct tdb_context *tdb,
-                         struct traverse_info *tinfo,
-                         TDB_DATA *kbuf, size_t *dlen);
+enum TDB_ERROR next_in_hash(struct tdb_context *tdb,
+                           struct traverse_info *tinfo,
+                           TDB_DATA *kbuf, size_t *dlen);
 
 /* Hash random memory. */
 uint64_t tdb_hash(struct tdb_context *tdb, const void *ptr, size_t len);
@@ -644,9 +644,9 @@ int tdb1_check(struct tdb_context *tdb,
 
 
 /* tdb1_open.c: */
-int tdb1_new_database(struct tdb_context *tdb,
-                     struct tdb_attribute_tdb1_hashsize *hashsize,
-                     struct tdb_attribute_tdb1_max_dead *max_dead);
+enum TDB_ERROR tdb1_new_database(struct tdb_context *tdb,
+                                struct tdb_attribute_tdb1_hashsize *hashsize,
+                                struct tdb_attribute_tdb1_max_dead *max_dead);
 enum TDB_ERROR tdb1_open(struct tdb_context *tdb,
                         struct tdb_attribute_tdb1_max_dead *max_dead);