X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fhtable%2Fhtable_type.h;h=15a70fc28d039e31f9285f83a496e14faa09c71f;hb=c23a40c7f1ac9fad0146b46988a41f196aae933f;hp=2afa1484756025c21ee122dcd31dbc59623fab24;hpb=a0f174c63680a3dd8fc61333f79231ffdf7e96b1;p=ccan diff --git a/ccan/htable/htable_type.h b/ccan/htable/htable_type.h index 2afa1484..15a70fc2 100644 --- a/ccan/htable/htable_type.h +++ b/ccan/htable/htable_type.h @@ -55,6 +55,7 @@ struct name##_iter { struct htable_iter i; }; \ static inline size_t name##_hash(const void *elem, void *priv) \ { \ + (void)priv; \ return hashfn(keyof((const type *)elem)); \ } \ static inline UNNEEDED void name##_init(struct name *ht) \ @@ -80,7 +81,7 @@ return htable_del(&ht->raw, hashfn(keyof(elem)), elem); \ } \ static inline UNNEEDED type *name##_get(const struct name *ht, \ - const HTABLE_KTYPE(keyof) k) \ + const HTABLE_KTYPE(keyof, type) k) \ { \ /* Typecheck for eqfn */ \ (void)sizeof(eqfn((const type *)NULL, \ @@ -91,7 +92,7 @@ k); \ } \ static inline UNNEEDED type *name##_getmatch_(const struct name *ht, \ - const HTABLE_KTYPE(keyof) k, \ + const HTABLE_KTYPE(keyof, type) k, \ size_t h, \ type *v, \ struct name##_iter *iter) \ @@ -104,7 +105,7 @@ return v; \ } \ static inline UNNEEDED type *name##_getfirst(const struct name *ht, \ - const HTABLE_KTYPE(keyof) k, \ + const HTABLE_KTYPE(keyof, type) k, \ struct name##_iter *iter) \ { \ size_t h = hashfn(k); \ @@ -112,7 +113,7 @@ return name##_getmatch_(ht, k, h, v, iter); \ } \ static inline UNNEEDED type *name##_getnext(const struct name *ht, \ - const HTABLE_KTYPE(keyof) k, \ + const HTABLE_KTYPE(keyof, type) k, \ struct name##_iter *iter) \ { \ size_t h = hashfn(k); \ @@ -120,7 +121,7 @@ return name##_getmatch_(ht, k, h, v, iter); \ } \ static inline UNNEEDED bool name##_delkey(struct name *ht, \ - const HTABLE_KTYPE(keyof) k) \ + const HTABLE_KTYPE(keyof, type) k) \ { \ type *elem = name##_get(ht, k); \ if (elem) \ @@ -139,8 +140,8 @@ } #if HAVE_TYPEOF -#define HTABLE_KTYPE(keyof) typeof(keyof(NULL)) +#define HTABLE_KTYPE(keyof, type) typeof(keyof((const type *)NULL)) #else -#define HTABLE_KTYPE(keyof) void * +#define HTABLE_KTYPE(keyof, type) void * #endif #endif /* CCAN_HTABLE_TYPE_H */