mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-03 12:36:53 +02:00
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:
parent
7fabc62de7
commit
9a76ff17c1
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/gobject/ifacecheck.c: Test case for
|
* tests/gobject/ifacecheck.c: Test case for
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/gobject/ifacecheck.c: Test case for
|
* tests/gobject/ifacecheck.c: Test case for
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/gobject/ifacecheck.c: Test case for
|
* tests/gobject/ifacecheck.c: Test case for
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/gobject/ifacecheck.c: Test case for
|
* tests/gobject/ifacecheck.c: Test case for
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/gobject/ifacecheck.c: Test case for
|
* tests/gobject/ifacecheck.c: Test case for
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
Thu Oct 2 01:15:46 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/gobject/ifacecheck.c: Test case for
|
* tests/gobject/ifacecheck.c: Test case for
|
||||||
|
10
acinclude.m4
10
acinclude.m4
@ -20,6 +20,16 @@ doit(char * s, ...)
|
|||||||
r = vsnprintf(buffer, 5, s, args);
|
r = vsnprintf(buffer, 5, s, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
if (r != 7)
|
||||||
|
exit(1);
|
||||||
|
|
||||||
|
/* AIX 5.1 and Solaris seems to have a half-baked vsnprintf()
|
||||||
|
implementation. The above will return 7 but if you replace
|
||||||
|
the size of the buffer with 0, it borks! */
|
||||||
|
va_start(args, s);
|
||||||
|
r = vsnprintf(buffer, 0, s, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
if (r != 7)
|
if (r != 7)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
|
@ -773,9 +773,6 @@ if test "$enable_included_printf" != "yes" ; then
|
|||||||
else
|
else
|
||||||
glib_cv_long_long_format="ll"
|
glib_cv_long_long_format="ll"
|
||||||
AC_DEFINE(HAVE_VASPRINTF,1)
|
AC_DEFINE(HAVE_VASPRINTF,1)
|
||||||
AC_DEFINE(HAVE_C99_VSNPRINTF,1)
|
|
||||||
AC_DEFINE(HAVE_C99_SNPRINTF,1)
|
|
||||||
AC_DEFINE(HAVE_UNIX98_PRINTF,1)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks needed for gnulib vasnprintf
|
# Checks needed for gnulib vasnprintf
|
||||||
@ -1932,7 +1929,6 @@ AC_ARG_ENABLE(man,
|
|||||||
[AC_HELP_STRING([--enable-man],
|
[AC_HELP_STRING([--enable-man],
|
||||||
[regenerate man pages from Docbook [default=no]])],enable_man=yes,
|
[regenerate man pages from Docbook [default=no]])],enable_man=yes,
|
||||||
enable_man=no)
|
enable_man=no)
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Check for xsltproc
|
dnl Check for xsltproc
|
||||||
dnl
|
dnl
|
||||||
|
@ -13,9 +13,9 @@ be found at:
|
|||||||
|
|
||||||
http://www.gnu.org/software/gnulib/
|
http://www.gnu.org/software/gnulib/
|
||||||
|
|
||||||
They have been modified to include g-gnulib.h. vasnprintf.c has also been modified to
|
They have been modified to include g-gnulib.h. vasnprintf.c has also
|
||||||
include support for long long printing if the system printf doesn't. This code is protected
|
been modified to include support for long long printing if the system
|
||||||
by #ifndef HAVE_LON_LONG_FORMAT.
|
printf doesn't. This code is protected by #ifndef HAVE_LON_LONG_FORMAT.
|
||||||
|
|
||||||
The files
|
The files
|
||||||
|
|
||||||
@ -24,10 +24,10 @@ The files
|
|||||||
g-gnulib.h
|
g-gnulib.h
|
||||||
|
|
||||||
have been written by me. printf.[hc] contain implementations of the
|
have been written by me. printf.[hc] contain implementations of the
|
||||||
remaining functions in the printf family based on
|
remaining functions in the printf family based on vasnprintf.
|
||||||
vasnprintf. g-gnulib.h is included by all source files in order to
|
g-gnulib.h is included by all source files in order to move all
|
||||||
move all exported functions to the _g_gnulib namespace, replace malloc
|
exported functions to the _g_gnulib namespace, replace malloc by
|
||||||
by g_malloc and make sure that snprintf is only used if it implements
|
g_malloc and make sure that snprintf is only used if it implements
|
||||||
C99 return value semantics.
|
C99 return value semantics.
|
||||||
|
|
||||||
Matthias Clasen
|
Matthias Clasen
|
||||||
|
@ -96,7 +96,7 @@ int _g_gnulib_vfprintf (FILE *file, char const *format, va_list args)
|
|||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fwrite (result, 1, length + 1, file);
|
fwrite (result, 1, length, file);
|
||||||
free (result);
|
free (result);
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
|
@ -300,7 +300,7 @@ g_vasprintf (gchar **string,
|
|||||||
gint len;
|
gint len;
|
||||||
g_return_val_if_fail (string != NULL, -1);
|
g_return_val_if_fail (string != NULL, -1);
|
||||||
|
|
||||||
#ifdef HAVE_VASPRINTF
|
#ifdef _g_vasprintf
|
||||||
len = _g_vasprintf (string, format, args);
|
len = _g_vasprintf (string, format, args);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
*string = NULL;
|
*string = NULL;
|
||||||
|
@ -39,7 +39,9 @@
|
|||||||
#define _g_vsprintf vsprintf
|
#define _g_vsprintf vsprintf
|
||||||
#define _g_vsnprintf vsnprintf
|
#define _g_vsnprintf vsnprintf
|
||||||
|
|
||||||
|
#ifdef HAVE_VASPRINTF
|
||||||
#define _g_vasprintf vasprintf
|
#define _g_vasprintf vasprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user