[oss-devel] ossxmix patch to ignore empty mixer groups
Yair K.
cesium2 at gmail.com
Fri Jun 6 21:51:01 EEST 2008
On Friday 06 June 2008 21:34:19 Zakhar Levchenko wrote:
> Since in the case when parent value is out of bounds parentrec is always
> zero and not zero if parent value is in the range [0..n-1],
>
> while(parent >= 0 && parent < n &&... structure is fully equivalent to
> while(parentrec &&...
>
> The only difference between previous and current version is that previously
> parentrec might potentially be an invalid pointer. Yes, no data was accessed
> by this pointer (check for parent value in the loop condition prevented
> this), but I hate to have invalid pointers even if they are not used. I hope
> this explains why I've changed code a bit.
>
Somehow 0 made me think of &extrec[dev][0] and not NULL.. You really should be using NULL for pointers and 0 for integers ("But this is entirely equivalent!" It's still bad programming[1]).
[1] http://lwn.net/Articles/93574/
Yours,
Yair K.
More information about the oss-devel
mailing list