[PATCH libinput 9/9] touchpad: Always assign iterator in tp_for_each_touch macro

Jonas Ådahl jadahl at gmail.com
Wed Apr 9 23:27:10 PDT 2014


On Thu, Apr 10, 2014 at 03:55:29PM +1000, Peter Hutterer wrote:
> On Wed, Apr 09, 2014 at 09:02:16PM +0200, Jonas Ådahl wrote:
> > Rewrite the tp_for_each_touch macro to always assign the iterator.
> > Practically it was already always assigning as ntouches is always more
> > than 0, but this way we avoid a compiler warning by not relying on an
> > external variable for initiating the iterator.
> > 
> > Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> 
> 6, 7, and this one Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Thanks for the review.

> 
> Cheers,
>    Peter
> 
> 
> 
> > ---
> >  src/evdev-mt-touchpad.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
> > index 2bdb329..3377789 100644
> > --- a/src/evdev-mt-touchpad.h
> > +++ b/src/evdev-mt-touchpad.h
> > @@ -141,7 +141,7 @@ struct tp_dispatch {
> >  };
> >  
> >  #define tp_for_each_touch(_tp, _t) \
> > -	for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
> > +	for (_t = (_tp)->touches; _t < (_tp)->touches + (_tp)->ntouches; _t++)
> >  
> >  void
> >  tp_get_delta(struct tp_touch *t, double *dx, double *dy);
> > -- 
> > 1.8.3.2
> > 
> > _______________________________________________
> > 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