[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: *printf declarations in stdio.h?
From: |
Bruno Haible |
Subject: |
Re: *printf declarations in stdio.h? |
Date: |
Tue, 20 Mar 2007 01:23:16 +0100 |
User-agent: |
KMail/1.5.4 |
Simon Josefsson wrote:
> How about this?
>
> /Simon
>
> 2007-03-13 Simon Josefsson <address@hidden>
>
> * m4/stdio_h.m4: Add stubs for vasprintf too.
>
> * modules/stdio: Support vasprintf in sed command.
>
> * modules/vasprintf: Depend on stdio for prototypes, and remove
> vasprintf.h.
>
> * lib/stdio_.h: Declare asprintf and vasprintf, based on
> vasprintf.h.
>
> * lib/asprintf.c: Use stdio.h for prototypes.
> * lib/vasprintf.c: Ditto.
>
> * lib/vasprintf.h: File removed.
>
> * tests/test-vasprintf-posix.c: Use stdio.h instead of vasprintf.h.
> * tests/test-vasprintf.c: Ditto.
> * lib/xvasprintf.c: Ditto.
Better but still incomplete:
> +# if @REPLACE_VASPRINTF@ || address@hidden@
> + /* Write formatted output to a string dynamically allocated with malloc().
> + If the memory allocation succeeds, store the address of the string in
> + *RESULT and return the number of resulting bytes, excluding the trailing
> + NUL. Upon memory allocation error, or some other error, return -1. */
> + extern int asprintf (char **result, const char *format, ...)
> + __attribute__ ((__format__ (__printf__, 2, 3)));
> + extern int vasprintf (char **result, const char *format, va_list args)
> + __attribute__ ((__format__ (__printf__, 2, 0)));
> +# endif
Why here you use @HAVE_DECL_VASPRINTF@ where the original code used
HAVE_VASPRINTF? Did you encounter a platform which has the same vasprintf()
but doesn't declare it? vasprintf is not a standardized, therefore I can well
imagine a platform which has a vasprintf that returns a 'char *' instead
of 'int' - then testing HAVE_VASPRINTF is safer.
And I don't see any m4/* code that would set the shell variable HAVE_VASPRINTF
or HAVE_DECL_VASPRINTF to 0. It is only ever set to 1, which is not the
intent.
Bruno
- *printf declarations in stdio.h?, Simon Josefsson, 2007/03/12
- Re: *printf declarations in stdio.h?, Bruno Haible, 2007/03/12
- Re: *printf declarations in stdio.h?, Simon Josefsson, 2007/03/13
- Re: *printf declarations in stdio.h?,
Bruno Haible <=
- Re: *printf declarations in stdio.h?, Simon Josefsson, 2007/03/22
- Re: *printf declarations in stdio.h?, Bruno Haible, 2007/03/22
- Re: *printf declarations in stdio.h?, Simon Josefsson, 2007/03/27
- Re: *printf declarations in stdio.h?, Bruno Haible, 2007/03/27
- Re: *printf declarations in stdio.h?, Simon Josefsson, 2007/03/27
- Re: *printf declarations in stdio.h?, Bruno Haible, 2007/03/27
- Re: *printf declarations in stdio.h?, Simon Josefsson, 2007/03/27
- Re: *printf declarations in stdio.h?, Bruno Haible, 2007/03/27
- Re: *printf declarations in stdio.h?, Simon Josefsson, 2007/03/27
- Re: *printf declarations in stdio.h?, Eric Blake, 2007/03/28