Make the various printf feature test macros reflect the system printf,

2003-10-05  Matthias Clasen  <maclas@gmx.de>

	* configure.in: Make the various printf feature test macros
	reflect the system printf, even when using the included printf.
	In particular, don't force HAVE_C99_SNPRINTF, since g-gnulib.h
	needs that test result.  (#122973)

	* glib/gprintf.c (g_vasprintf): Don't rely on HAVE_VASPRINTF,
	directly check for _g_vasprintf.

	* glib/gprintfint.h (_g_vasprintf): Only define _g_vasprintf()
	if vasprintf() is available.

	* glib/gnulib/printf.c (_g_gnulib_vfprintf): Don't write
	trailing nul to the file. (#122973)

	* acinclude.m4 (AC_FUNC_VSNPRINTF_C99): Make the test
	detect non-C99-compliance of AIX 5.1 and Solaris
	vsnprintf().  (#122496)
This commit is contained in:
Matthias Clasen
2003-10-04 23:24:02 +00:00
committed by Matthias Clasen
parent 7fabc62de7
commit 9a76ff17c1
12 changed files with 144 additions and 16 deletions

View File

@@ -13,22 +13,22 @@ be found at:
http://www.gnu.org/software/gnulib/
They have been modified to include g-gnulib.h. vasnprintf.c has also been modified to
include support for long long printing if the system printf doesn't. This code is protected
by #ifndef HAVE_LON_LONG_FORMAT.
They have been modified to include g-gnulib.h. vasnprintf.c has also
been modified to include support for long long printing if the system
printf doesn't. This code is protected by #ifndef HAVE_LON_LONG_FORMAT.
The files
The files
printf.h
printf.c
g-gnulib.h
have been written by me. printf.[hc] contain implementations of the
remaining functions in the printf family based on
vasnprintf. g-gnulib.h is included by all source files in order to
move all exported functions to the _g_gnulib namespace, replace malloc
by g_malloc and make sure that snprintf is only used if it implements
C99 return value semantics.
have been written by me. printf.[hc] contain implementations of the
remaining functions in the printf family based on vasnprintf.
g-gnulib.h is included by all source files in order to move all
exported functions to the _g_gnulib namespace, replace malloc by
g_malloc and make sure that snprintf is only used if it implements
C99 return value semantics.
Matthias Clasen
July 28, 2003

View File

@@ -96,7 +96,7 @@ int _g_gnulib_vfprintf (FILE *file, char const *format, va_list args)
if (result == NULL)
return -1;
fwrite (result, 1, length + 1, file);
fwrite (result, 1, length, file);
free (result);
return length;

View File

@@ -300,7 +300,7 @@ g_vasprintf (gchar **string,
gint len;
g_return_val_if_fail (string != NULL, -1);
#ifdef HAVE_VASPRINTF
#ifdef _g_vasprintf
len = _g_vasprintf (string, format, args);
if (len < 0)
*string = NULL;

View File

@@ -39,7 +39,9 @@
#define _g_vsprintf vsprintf
#define _g_vsnprintf vsnprintf
#ifdef HAVE_VASPRINTF
#define _g_vasprintf vasprintf
#endif
#else