[MPlayer-dev-eng] [PATCH] replacement for internal mpg123 fork (mp3lib), Final version?

Dominik 'Rathann' Mierzejewski dominik at rangers.eu.org
Tue May 25 12:52:37 CEST 2010


On Tuesday, 25 May 2010 at 09:59, Thomas Orgis wrote:
> Am Mon, 24 May 2010 16:58:55 +0200
> schrieb Dominik 'Rathann' Mierzejewski <dominik at rangers.eu.org>: 
> 
> > > +  bad_end:
> > > +    if (!con->handle)
> > > +        mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 preinit error: %s\n",
> > > +               mpg123_plain_strerror(err));
> > > +    else
> > > +        mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 preinit error: %s\n",
> > > +               mpg123_strerror(con->handle));
> > > +
> > > +    if (con->handle)
> > > +        mpg123_delete(con->handle);
> > 
> > This if() can be merged with the else above.
> 
> Hm, or what about that:
> 
> bad_end:
>   mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 preinit error: %s\n",
>              con->handle ? mpg123_strerror(con->handle) : mpg123_plain_strerror(err));
> 
>   if (con->handle)
>       mpg123_delete(con->handle);

To be honest, I don't know what's worse, duplicating the same string (compiler will
probably optimize) or testing the same condition twice. Maybe someone else has
a suggestion how to optimize this piece of code.

Regards,
R.

-- 
MPlayer http://mplayerhq.hu | RPMFusion http://rpmfusion.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
	-- from "Collected Sayings of Muad'Dib" by the Princess Irulan



More information about the MPlayer-dev-eng mailing list