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

Diego Biurrun diego at biurrun.de
Wed Jan 26 16:17:08 CET 2011


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.

> 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.

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

nit: GNU

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

Diego


More information about the MPlayer-dev-eng mailing list