summaryrefslogtreecommitdiff
path: root/console-client
diff options
context:
space:
mode:
authorDiego Nieto Cid <dnietoc@gmail.com>2015-06-04 22:58:09 -0300
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-06-05 18:33:50 +0200
commitffea85471c65fd7758e159207ae7f7a089106644 (patch)
treed99601dc00282b4cefe39fc5dd00ee17c59b902e /console-client
parent50da095243745f2e2a0c3f4805fe187a392832b7 (diff)
console-client: assert precondition
* console-client/xkb/kstoucs.c (find_ucs): assert precondition.
Diffstat (limited to 'console-client')
-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 */