summaryrefslogtreecommitdiff
path: root/console-client/xkb/kstoucs.c
diff options
context:
space:
mode:
Diffstat (limited to 'console-client/xkb/kstoucs.c')
-rw-r--r--console-client/xkb/kstoucs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
index 8471e942..fb62445e 100644
--- a/console-client/xkb/kstoucs.c
+++ b/console-client/xkb/kstoucs.c
@@ -1,3 +1,5 @@
+#include <assert.h>
+
struct ksmap {
int keysym;
unsigned int ucs;
@@ -11,6 +13,8 @@ find_ucs (int keysym, struct ksmap *first, struct ksmap *last)
{
struct ksmap *middle = first + (last - first) / 2;
+ assert (first <= last);
+
if (middle->keysym == keysym)
return middle->ucs; /* base case: needle found. */
else if (first == last /* empty search space */