[MPlayer-dev-eng] [PATCH] Add mp_strings.c with mp_asprintf function.

Clément Bœsch ubitux at gmail.com
Thu Jan 27 21:11:25 CET 2011


On Wed, Jan 26, 2011 at 07:21:49PM +0100, Reimar Döffinger wrote:
> On Fri, Jan 21, 2011 at 03:28:33PM +0100, Clément Bœsch wrote:
> > On Fri, Jan 21, 2011 at 07:52:20AM +0100, Reimar Döffinger wrote:
> > > On 20 Jan 2011, at 21:48, Diego Biurrun <diego at biurrun.de> wrote:
> > > > On Thu, Jan 20, 2011 at 09:25:45PM +0100, Clément Bœsch wrote:
> > > >> On Tue, Jan 18, 2011 at 09:43:55AM +0100, Diego Biurrun wrote:
> > > >>> On Wed, Jan 12, 2011 at 11:44:32PM +0100, Clément Bœsch wrote:
> > > >>>> 
> > > >>>> I just made a small equivalent to the GNU asprintf function (since I
> > > >>>> suppose it's not available on all system supported by mplayer) in order to
> > > >>>> use it in a few places instead of fixed size buffers like BUFLENGTH in
> > > >>>> some vo (jpeg, png, …) and maybe a few other PATH_MAX we were speaking a
> > > >>>> while ago.
> > > >>> 
> > > >>> The traditional place for this is the osdep/ directory.  You should also
> > > >>> check in configure for its presence.
> > > >>> 
> > > >> 
> > > >> I would have done it in case the function were called "asprintf", and as
> > > >> pointed out on IRC, it would need a configure test, conditionally
> > > >> compilation, etc. which is a small burden.
> > > > 
> > > > It's easy enough to do.  If you need help, ask.
> > > 
> > > I have some concerns that this might also cause some issues when trying
> > > to move to std=c99.
> > 
> > What kind of issue?
> 
> Sorry for the late reply. What I would expect might happen is that in
> C99 mode asprintf is not available (and we certainly don't want to
> have yet another thing that requires _GNU_SOURCE everywhere), so
> configure detection will fail. However linking will fail as well,
> since then asprintf is defined both in the libc and in MPlayer.

I'm not sure I get the difference between the compilation test made at
./configure and the way mplayer is built; the asprintf test does not check
if we have _GNU_SOURCE defined, it try to compile a source code using it.
Or did I missed something again?

-- 
Clément B.


More information about the MPlayer-dev-eng mailing list