On Fri, Jun 22, 2012 at 11:17:38AM +0100, Bastien Nocera wrote:
> On Fri, 2012-06-22 at 16:29 +1000, Peter Hutterer wrote:
> > Pointless though, so let's complain about it.
> > 
> > Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> 
> Reviewed-By: Bastien Nocera <had...@hadess.net>
> 
> > ---
> >  libwacom/libwacom.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
> > index 482baa5..fe850a2 100644
> > --- a/libwacom/libwacom.c
> > +++ b/libwacom/libwacom.c
> > @@ -334,6 +334,8 @@ compare_matches(WacomDevice *a, WacomDevice *b)
> >  int
> >  libwacom_compare(WacomDevice *a, WacomDevice *b, WacomCompareFlags flags)
> >  {
> > +   g_return_val_if_fail(a || b, 0);
> 
> I would have preferred:
> g_return_val_if_fail(!a && !b, 0);

that's a different check though. if both a and b are null, the condition is
true and we crash later when we dereference a.
and if a and b are different, we already return 1, see just below here.

> >     if ((a && !b) || (b && !a))
> >             return 1;
> >  

Cheers,
  Peter

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to