misc: change hashtable compare function to return bool

It really doesn't make sense to expect an integer here as memcmp() and
friends use an integer, too, but in reversed logic. So use bool to avoid
confusion.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-07-01 19:29:33 +02:00
parent 3a1926b081
commit 25b81425ef
3 changed files with 4 additions and 4 deletions

View File

@ -300,7 +300,7 @@ unsigned int kmscon_direct_hash(const void *data)
return (unsigned int)(unsigned long)data;
}
int kmscon_direct_equal(const void *data1, const void *data2)
bool kmscon_direct_equal(const void *data1, const void *data2)
{
return data1 == data2;
}

View File

@ -76,11 +76,11 @@ void kmscon_hook_call(struct kmscon_hook *hook, void *parent, void *arg);
struct kmscon_hashtable;
typedef unsigned int (*kmscon_hash_cb) (const void *data);
typedef int (*kmscon_equal_cb) (const void *data1, const void *data2);
typedef bool (*kmscon_equal_cb) (const void *data1, const void *data2);
typedef void (*kmscon_free_cb) (void *data);
unsigned int kmscon_direct_hash(const void *data);
int kmscon_direct_equal(const void *data1, const void *data2);
bool kmscon_direct_equal(const void *data1, const void *data2);
int kmscon_hashtable_new(struct kmscon_hashtable **out,
kmscon_hash_cb hash_cb,

View File

@ -105,7 +105,7 @@ static guint hash_ucs4(gconstpointer key)
return val;
}
static gboolean cmp_ucs4(gconstpointer a, gconstpointer b)
static bool cmp_ucs4(gconstpointer a, gconstpointer b)
{
size_t i;
const uint32_t *v1, *v2;