At Fri, 07 Dec 2001 11:09:54 +0800,
Kyle Centers wrote:
>
> Hi
>
> Still nit-picking, but the following code is just ugly, and I cannot see any reason
>for writing it this way. From card_emu10k1.c (and a few other files in card/, as a
>quick look shows), the snd_emu10k1_probe(...), starting at line 97:
> for ( ; dev < SNDRV_CARDS; dev++) {
> if (!snd_enable[dev]) {
> dev++;
> return -ENOENT;
> }
> break;
> }
>
> Now as best I can tell, the following would do the same thing, but the structure is
>more clear, smaller, and probably faster:
>
> if( (dev < SNDRV_CARDS) && (!snd_enable[dev]) )
> {
> dev++;
> return -ENOENT;
> }
>
> Is there a reason for the for loop? or should that code be changed? I can't see any
>advanage to it at all.
I believe you're right.
The code could be like this:
int foo_probe()
{
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (! snd_enable[dev]) {
dev++;
return -ENOENT;
}
...
dev++;
return 0;
}
Jaroslav, do you see any problem?
Takashi
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel