[PATCH 2/4] Replace a few BUG_WARN with BUG_RETURN_VAL

Alan Coopersmith alan.coopersmith at oracle.com
Tue May 15 10:49:59 PDT 2012


On 05/15/12 03:26 AM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  Xi/exevents.c   |   25 ++++++++++---------------
>  dix/getevents.c |    5 +----
>  dix/touch.c     |   17 ++++++-----------
>  3 files changed, 17 insertions(+), 30 deletions(-)
> 
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index 3aa9030..7fbaa8f 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -948,10 +948,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
>      else if (event->type == ET_ProximityOut)
>          device->proximity->in_proximity = FALSE;
>      else if (event->type == ET_TouchBegin) {
> -        BUG_WARN(!b || !v);
> -        BUG_WARN(!t);
> +        BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
> +        BUG_RETURN_VAL(!t, DONT_PROCESS);
>  
> -        if (!b || !t || !b->map[key])
> +        if (!b->map[key])
>              return DONT_PROCESS;

It's intentional that you're now also returning DONT_PROCESS for !v where you
weren't before, right?   (In both this hunk and the next one.)

>          if (!(event->flags & TOUCH_POINTER_EMULATED) ||
> @@ -963,10 +963,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
>          UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
>      }
>      else if (event->type == ET_TouchEnd) {
> -        BUG_WARN(!b || !v);
> -        BUG_WARN(!t);
> +        BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
> +        BUG_RETURN_VAL(!t, DONT_PROCESS);
>  
> -        if (!b || !t || t->buttonsDown <= 0 || !b->map[key])
> +        if (t->buttonsDown <= 0 || !b->map[key])
>              return DONT_PROCESS;
>  
>          if (!(event->flags & TOUCH_POINTER_EMULATED))

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list