summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccan/htable/htable_type.h2
-rw-r--r--ccan/htable/test/run-type.c6
-rw-r--r--tools/ccanlint/file_analysis.c4
3 files changed, 7 insertions, 5 deletions
diff --git a/ccan/htable/htable_type.h b/ccan/htable/htable_type.h
index 6fe05e2f..0d9e3fbb 100644
--- a/ccan/htable/htable_type.h
+++ b/ccan/htable/htable_type.h
@@ -63,7 +63,7 @@ static inline type *htable_##name##_get(const struct htable_##name *ht, \
const HTABLE_KTYPE(keyof) k) \
{ \
/* Typecheck for cmpfn */ \
- (void)sizeof(cmpfn(keyof((const type *)NULL), \
+ (void)sizeof(cmpfn((const type *)NULL, \
keyof((const type *)NULL))); \
return (type *)htable_get((const struct htable *)ht, \
hashfn(k), \
diff --git a/ccan/htable/test/run-type.c b/ccan/htable/test/run-type.c
index 1ef42a4c..02dac29e 100644
--- a/ccan/htable/test/run-type.c
+++ b/ccan/htable/test/run-type.c
@@ -7,6 +7,8 @@
#define NUM_VALS (1 << HTABLE_BASE_BITS)
struct obj {
+ /* Makes sure we don't try to treat and obj as a key or vice versa */
+ unsigned char unused;
unsigned int key;
};
@@ -25,9 +27,9 @@ static size_t objhash(const unsigned int *key)
return h;
}
-static bool cmp(const unsigned int *key1, const unsigned int *key2)
+static bool cmp(const struct obj *obj, const unsigned int *key)
{
- return *key1 == *key2;
+ return obj->key == *key;
}
HTABLE_DEFINE_TYPE(struct obj, objkey, objhash, cmp, obj);
diff --git a/tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c
index 7b2565a9..14b2631e 100644
--- a/tools/ccanlint/file_analysis.c
+++ b/tools/ccanlint/file_analysis.c
@@ -33,9 +33,9 @@ static const char *manifest_name(const struct manifest *m)
return m->dir;
}
-static bool dir_cmp(const char *dir1, const char *dir2)
+static bool dir_cmp(const struct manifest *m, const char *dir)
{
- return strcmp(dir1, dir2) == 0;
+ return strcmp(m->dir, dir) == 0;
}
HTABLE_DEFINE_TYPE(struct manifest, manifest_name, dir_hash, dir_cmp, manifest);