]> git.ozlabs.org Git - ccan/commitdiff
tdb2: remove tdb_hashfn_t prototype
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 1 Mar 2011 12:49:19 +0000 (23:19 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 1 Mar 2011 12:49:19 +0000 (23:19 +1030)
It doesn't help the user, since they can't use it to declare their hash
function, and it just adds a level of mental indirection for us.

ccan/tdb2/private.h
ccan/tdb2/tdb2.h

index d32c7546e092d648e4a3a156c54358aaaa30c134..69fd40fce91fd295d2e868d569d60e6e804ecf4a 100644 (file)
@@ -338,7 +338,7 @@ struct tdb_context {
        void *log_private;
 
        /* Hash function. */
        void *log_private;
 
        /* Hash function. */
-       tdb_hashfn_t khash;
+       uint64_t (*khash)(const void *key, size_t len, uint64_t seed, void *);
        void *hash_priv;
        uint64_t hash_seed;
 
        void *hash_priv;
        uint64_t hash_seed;
 
index b482d2d636ebcf2247d88868feaa1d6fee28dff0..5e354dfe9b5d562603d474dacef0e771de53cefe 100644 (file)
@@ -78,8 +78,6 @@ struct tdb_context;
 
 /* FIXME: Make typesafe */
 typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
 
 /* FIXME: Make typesafe */
 typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
-typedef uint64_t (*tdb_hashfn_t)(const void *key, size_t len, uint64_t seed,
-                                void *priv);
 
 enum tdb_attribute_type {
        TDB_ATTRIBUTE_LOG = 0,
 
 enum tdb_attribute_type {
        TDB_ATTRIBUTE_LOG = 0,
@@ -104,7 +102,8 @@ struct tdb_attribute_log {
 
 struct tdb_attribute_hash {
        struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_HASH */
 
 struct tdb_attribute_hash {
        struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_HASH */
-       tdb_hashfn_t hash_fn;
+       uint64_t (*hash_fn)(const void *key, size_t len, uint64_t seed,
+                           void *priv);
        void *hash_private;
 };
 
        void *hash_private;
 };