From 51c9f8e24dbe12e289caf5ac12f02aa6338c56ac Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 2 Jan 2014 01:19:25 +0200 Subject: [PATCH] keysym: clarify slightly confusing comparison functions Make it clear what the search key type and array types are. Signed-off-by: Ran Benita --- src/keysym.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/keysym.c b/src/keysym.c index 1a13cf7..f52d751 100644 --- a/src/keysym.c +++ b/src/keysym.c @@ -62,15 +62,17 @@ get_name(const struct name_keysym *entry) static int compare_by_keysym(const void *a, const void *b) { + const xkb_keysym_t *key = a; const struct name_keysym *entry = b; - return *(const int32_t *)(a) - entry->keysym; + return *key - (int32_t) entry->keysym; } static int compare_by_name(const void *a, const void *b) { + const char *key = a; const struct name_keysym *entry = b; - return strcasecmp((const char *)a, get_name(entry)); + return strcasecmp(key, get_name(entry)); } XKB_EXPORT int -- 2.7.4