projects
/
platform
/
upstream
/
libxkbcommon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
68b0309
)
keysym: use safe keysym comparison function
author
Ran Benita
<ran234@gmail.com>
Sat, 8 Feb 2014 15:58:39 +0000
(17:58 +0200)
committer
Ran Benita
<ran234@gmail.com>
Sat, 8 Feb 2014 15:58:39 +0000
(17:58 +0200)
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>
src/keysym.c
patch
|
blob
|
history
diff --git
a/src/keysym.c
b/src/keysym.c
index
f52d751
..
e8fa5e1
100644
(file)
--- a/
src/keysym.c
+++ b/
src/keysym.c
@@
-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