Re: [compiz] [Intel-gfx] compiz swapbuffers patch

2009-05-20 Thread Barry Scott
Jesse Barnes wrote:
> On Fri, 08 May 2009 10:27:49 +0100
> Barry Scott  wrote:
>
>   
>> Jesse Barnes wrote:
>>
>> Why are you comparing booleans to TRUE and worse then negating the
>> result?
>>
>> if( !noWait )
>>
>> Is clearer.
>>
>> -waitForVideoSync (s);
>> +if (!(noWait == TRUE))
>> +waitForVideoSync (s);
>> 
>
> Yeah I've been looking at too much X code.  In some places the style is
> like if (foo == NULL) { ... handle failure ...}.
>   
Personally I always compare to NULL if foo is a pointer as it makes the 
intent
of the code clear.

Barry

___
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz


Re: [compiz] [Intel-gfx] compiz swapbuffers patch

2009-05-20 Thread Jesse Barnes
On Fri, 08 May 2009 10:27:49 +0100
Barry Scott  wrote:

> Jesse Barnes wrote:
> 
> Why are you comparing booleans to TRUE and worse then negating the
> result?
> 
> if( !noWait )
> 
> Is clearer.
> 
> - waitForVideoSync (s);
> + if (!(noWait == TRUE))
> + waitForVideoSync (s);

Oh and this double negative stuff is ugly too.  I probably should have
made the variable doVsync or something and defaulted it to true unless
--no-wait was passed, then I could have just done if (doVsync) { .. }.

Anyway if someone wants to apply this I'd be happy to fix it up.  FWIW
I'm running it on my desktop right now with the new options and it's
working nicely; no tearing or anything.

-- 
--
Jesse Barnes, Intel Open Source Technology Center
___
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz


Re: [compiz] [Intel-gfx] compiz swapbuffers patch

2009-05-20 Thread Jesse Barnes
On Fri, 08 May 2009 10:27:49 +0100
Barry Scott  wrote:

> Jesse Barnes wrote:
> 
> Why are you comparing booleans to TRUE and worse then negating the
> result?
> 
> if( !noWait )
> 
> Is clearer.
> 
> - waitForVideoSync (s);
> + if (!(noWait == TRUE))
> + waitForVideoSync (s);

Yeah I've been looking at too much X code.  In some places the style is
like if (foo == NULL) { ... handle failure ...}.

I really prefer the shorter checks though; not sure why I jumped
through hoops here.

-- 
--
Jesse Barnes, Intel Open Source Technology Center
___
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz


Re: [compiz] [Intel-gfx] compiz swapbuffers patch

2009-05-20 Thread Barry Scott
Jesse Barnes wrote:

Why are you comparing booleans to TRUE and worse then negating the result?

if( !noWait )

Is clearer.

-   waitForVideoSync (s);
+   if (!(noWait == TRUE))
+   waitForVideoSync (s);


Barry





___
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz