Simon Josefsson wrote: > How about this? > > /Simon > > 2007-03-13 Simon Josefsson <[EMAIL PROTECTED]> > > * 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@ || [EMAIL PROTECTED]@ > + /* 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