[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] * console-client/xkb/kstoucs.c (find_ucs): assert precon
From: |
Justus Winter |
Subject: |
Re: [PATCH 1/2] * console-client/xkb/kstoucs.c (find_ucs): assert precondition. |
Date: |
Fri, 05 Jun 2015 18:36:44 +0200 |
User-agent: |
alot/0.3.5 |
Merged, thanks. I took the liberty of adding a subject line to the
commit message.
Quoting Diego Nieto Cid (2015-06-05 03:58:09)
> ---
> console-client/xkb/kstoucs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
> index 8471e94..fb62445 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 */
> --
> 2.1.4
>
>