[PATCH xkbcommon] keysym-utf: Fix a warning about shadowing

Ran Benita ran234 at gmail.com
Mon Oct 7 20:03:04 CEST 2013


On Mon, Oct 07, 2013 at 02:11:36PM +0530, Siddharth Heroor wrote:
> Change variable names to avoid the name clash. The warning seen is
> 
> src/keysym-utf.c: In function 'bin_search':
> src/keysym-utf.c:841: warning: declaration of 'min' shadows a global declaration
> src/utils.h:109: warning: shadowed declaration is here
> src/keysym-utf.c:842: warning: declaration of 'max' shadows a global declaration
> src/utils.h:115: warning: shadowed declaration is here
> 
> Signed-off-by: Siddharth Heroor <heroor at ti.com>

Applied, thanks.

Ran

> ---
>  src/keysym-utf.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/keysym-utf.c b/src/keysym-utf.c
> index 5484a83..9a96053 100644
> --- a/src/keysym-utf.c
> +++ b/src/keysym-utf.c
> @@ -838,20 +838,20 @@ static const struct codepair keysymtab[] = {
>  static uint32_t
>  bin_search(const struct codepair *table, size_t length, xkb_keysym_t keysym)
>  {
> -    int min = 0;
> -    int max = length;
> +    int first = 0;
> +    int last = length;
>      int mid;
>  
>      if (keysym < table[0].keysym  || keysym > table[length].keysym)
>          return 0;
>  
>      /* binary search in table */
> -    while (max >= min) {
> -        mid = (min + max) / 2;
> +    while (last >= first) {
> +        mid = (first + last) / 2;
>          if (table[mid].keysym < keysym)
> -            min = mid + 1;
> +            first = mid + 1;
>          else if (table[mid].keysym > keysym)
> -            max = mid - 1;
> +            last = mid - 1;
>          else /* found it */
>              return table[mid].ucs;
>      }
> -- 
> 1.7.0.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list