Commit 51c9f8e24dbe12e289caf5ac12f02aa6338c56ac

Ran Benita 2014-01-02T01:19:25

keysym: clarify slightly confusing comparison functions Make it clear what the search key type and array types are. Signed-off-by: Ran Benita <ran234@gmail.com>

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