kdemultimedia3 - patch to fix lockup of audiocd:/ kioslave

Thomas Braxton brax108 at cox.net
Sat Sep 23 04:19:34 BST 2006


On Friday 22 September 2006 19:10, Tilman Vogel wrote:
> Thomas Braxton schrieb:
> > On Friday 22 September 2006 06:08, Tilman Vogel wrote:
> >> +       if(drive->ioctl_device_name && strlen(drive->ioctl_device_name))
> >> +         d->cd.setDevice(drive->ioctl_device_name, 50, false);
> >> +       else
> >> +         d->cd.setDevice(drive->cdda_device_name, 50, false);
> >
> > couldn't this be changed to:
> >
> > if(drive->ioctl_device_name && drive->ioctl_device_name[0])
> >   d->cd.setDevice(drive->ioctl_device_name, 50, false);
> > else
> >   d->cd.setDevice(drive->cdda_device_name, 50, false);
> >
> > why compute the length of the string if you only care if it's empty or
> > not.
>
> Well, you're right. No objections. If you care about that bit of
> computational time ;-) Counting the length of something like "" or
> "/dev/sg0" won't take much time either, I guess...
>
> On the other hand, why stop here. I guess you can find many more nice
> possibilities to optimise code there...

why make a function call when you only care if the first byte is 0 or not?

> Furthermore, one should maybe also add a check, if
> drive->cdda_device_name is valid. Although, the previous version of the
> code didn't and seemingly worked in many cases (but mine)...

might be a good idea, what's stopping you?

Thomas




More information about the kde-core-devel mailing list