[PATCH:xkbutils] XkbQueryExtension returns a Bool, don't use > 0 to check it

Peter Hutterer peter.hutterer at who-t.net
Sun Dec 8 15:52:20 PST 2013


On Sun, Dec 08, 2013 at 01:10:26PM -0800, Alan Coopersmith wrote:
> We just want to know if XkbQueryExtension returned false, so ! is enough,
> don't need > 0 as well.
> 
> Reported by cppcheck:
> [app/xkbutils/xkbbell.c:205]: (warning) Comparison of a boolean value
>  using relational operator (<, >, <= or >=).
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter

> ---
>  xkbbell.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xkbbell.c b/xkbbell.c
> index ac06b35..95b8604 100644
> --- a/xkbbell.c
> +++ b/xkbbell.c
> @@ -202,7 +202,7 @@ main(int argc, char *argv[])
>                  XkbMajorVersion, XkbMinorVersion);
>          fprintf(stderr, "         Trying anyway\n");
>      }
> -    if (!XkbQueryExtension(dpy, &i1, &i2, &i3, &i4, &i5) > 0) {
> +    if (!XkbQueryExtension(dpy, &i1, &i2, &i3, &i4, &i5)) {
>          if ((i4 != 0) || (i5 != 0))
>              fprintf(stderr,
>                      "server supports incompatible XKB version %d.%02d\n", i4,
> -- 
> 1.7.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list