keysym: use safe keysym comparison function

Instead of thinking about signed <-> unsigned an whatnot.
bsearch() is inline in glibc, so gcc optimizes this away anyway.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2014-02-08 17:58:39 +02:00
parent 68b0309792
commit 3d56aa3e60
1 changed files with 5 additions and 1 deletions

View File

@ -64,7 +64,11 @@ compare_by_keysym(const void *a, const void *b)
{
const xkb_keysym_t *key = a;
const struct name_keysym *entry = b;
return *key - (int32_t) entry->keysym;
if (*key < entry->keysym)
return -1;
if (*key > entry->keysym)
return 1;
return 0;
}
static int