struct hash_table;
typedef unsigned (*hash_func_t)(const void *key);
-typedef int (*hash_compare_func_t)(const void *key1, const void *key2);
+typedef bool (*hash_compare_func_t)(const void *key1, const void *key2);
/**
* Hash table constructor
/**
* Compare two strings used as keys
*
- * This is just a macro wrapper around \c strcmp.
+ * This is just a wrapper around \c strcmp.
*
* \sa hash_table_string_hash
*/
-#define hash_table_string_compare ((hash_compare_func_t) strcmp)
-
+bool hash_table_string_compare(const void *a, const void *b);
/**
* Compute hash value of a pointer
*
* \sa hash_table_pointer_hash
*/
-int
+bool
hash_table_pointer_compare(const void *key1, const void *key2);
void
return hash;
}
+bool hash_table_string_compare(const void *a, const void *b)
+{
+ return strcmp(a, b) == 0;
+}
+
unsigned
hash_table_pointer_hash(const void *key)
}
-int
+bool
hash_table_pointer_compare(const void *key1, const void *key2)
{
- return key1 == key2 ? 0 : 1;
+ return key1 == key2;
}