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

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


On Wed, Jan 26, 2011 at 04:17:08PM +0100, Diego Biurrun wrote:
> On Fri, Jan 21, 2011 at 03:28:33PM +0100, Clément Bœsch wrote:
> > 
> > As you wish. Here is a second patch with asprintf tested at configure
> > time, choose whatever you prefer.
> > 
> > Note on this second patch: I can't test it properly, but I mostly based
> > the code on the strsep code so it should do the trick. If anyone can
> > test it on a non-gnu system, please test if osdep/asprintf.c is well built.
> 
> Just rename the function to asprintf2, detection will fail and you can
> test if everything still works properly.
> 

Done. It works. But still… :)

> > Note 2: maybe there is some kind of helper to simplify the test, and still
> > not in use for the strsep code, but I didn't find one. If there is, I'll
> > of course update the code.
> > 
> > --- a/configure
> > +++ b/configure
> > @@ -3811,6 +3811,19 @@ fi
> >  
> > +echocheck "asprintf()"
> > +_asprintf=no
> > +statement_check stdio.h 'char *s; asprintf(&s, "%s:%d", "hello", 0x2a)' && _asprintf=yes
> > +if test "$_asprintf" = yes ; then
> 
> Please use just "asprintf" as variable name, I plan to eventually
> drop all leading underscores.
> 

You just fixed the _need_* variables into need_* (for example there is
still _strsep). I fixed locally the _need_asprintf. Should I do the same
with _asprintf?

> > --- /dev/null
> > +++ b/osdep/asprintf.c
> > @@ -0,0 +1,50 @@
> > +/*
> > + * asprintf implementation for non-gnu systems
> 
> nit: GNU
> 

Fixed locally.

> No comment about the implementation; I haven't even read the asprintf
> man page yet.
> 
> > --- /dev/null
> > +++ b/osdep/asprintf.h
> > @@ -0,0 +1,26 @@
> > +/*
> > + * asprintf implementation for non-gnu systems
> 
> ditto
> 

Fixed locally.

-- 
Clément B.


More information about the MPlayer-dev-eng mailing list