Fix #147651, reported by Oliver Guntermann:

2004-07-21  Matthias Clasen  <mclasen@redhat.com>

	Fix #147651, reported by Oliver Guntermann:

	* glib/gprintfint.h (_g_vasprintf): Don't wrap vasprintf(),
	_g_gnulib_vasprintf() in a macro, since they behave
	differently wrt. to memory allocation.

	* glib/gprintf.c (g_vasprintf): Instead, differentiate
	here between the three cases: system vasprintf(),
	_g_gnulib_vasprintf(), no vasprintf().
This commit is contained in:
Matthias Clasen 2004-07-21 17:51:28 +00:00 committed by Matthias Clasen
parent 059b48dd84
commit 495377c45e
7 changed files with 73 additions and 8 deletions

View File

@ -1,3 +1,15 @@
2004-07-21 Matthias Clasen <mclasen@redhat.com>
Fix #147651, reported by Oliver Guntermann:
* glib/gprintfint.h (_g_vasprintf): Don't wrap vasprintf(),
_g_gnulib_vasprintf() in a macro, since they behave
differently wrt. to memory allocation.
* glib/gprintf.c (g_vasprintf): Instead, differentiate
here between the three cases: system vasprintf(),
_g_gnulib_vasprintf(), no vasprintf().
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
* NEWS: Fix a typo in my name

View File

@ -1,3 +1,15 @@
2004-07-21 Matthias Clasen <mclasen@redhat.com>
Fix #147651, reported by Oliver Guntermann:
* glib/gprintfint.h (_g_vasprintf): Don't wrap vasprintf(),
_g_gnulib_vasprintf() in a macro, since they behave
differently wrt. to memory allocation.
* glib/gprintf.c (g_vasprintf): Instead, differentiate
here between the three cases: system vasprintf(),
_g_gnulib_vasprintf(), no vasprintf().
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
* NEWS: Fix a typo in my name

View File

@ -1,3 +1,15 @@
2004-07-21 Matthias Clasen <mclasen@redhat.com>
Fix #147651, reported by Oliver Guntermann:
* glib/gprintfint.h (_g_vasprintf): Don't wrap vasprintf(),
_g_gnulib_vasprintf() in a macro, since they behave
differently wrt. to memory allocation.
* glib/gprintf.c (g_vasprintf): Instead, differentiate
here between the three cases: system vasprintf(),
_g_gnulib_vasprintf(), no vasprintf().
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
* NEWS: Fix a typo in my name

View File

@ -1,3 +1,15 @@
2004-07-21 Matthias Clasen <mclasen@redhat.com>
Fix #147651, reported by Oliver Guntermann:
* glib/gprintfint.h (_g_vasprintf): Don't wrap vasprintf(),
_g_gnulib_vasprintf() in a macro, since they behave
differently wrt. to memory allocation.
* glib/gprintf.c (g_vasprintf): Instead, differentiate
here between the three cases: system vasprintf(),
_g_gnulib_vasprintf(), no vasprintf().
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
* NEWS: Fix a typo in my name

View File

@ -1,3 +1,15 @@
2004-07-21 Matthias Clasen <mclasen@redhat.com>
Fix #147651, reported by Oliver Guntermann:
* glib/gprintfint.h (_g_vasprintf): Don't wrap vasprintf(),
_g_gnulib_vasprintf() in a macro, since they behave
differently wrt. to memory allocation.
* glib/gprintf.c (g_vasprintf): Instead, differentiate
here between the three cases: system vasprintf(),
_g_gnulib_vasprintf(), no vasprintf().
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
* NEWS: Fix a typo in my name

View File

@ -300,17 +300,27 @@ g_vasprintf (gchar **string,
gint len;
g_return_val_if_fail (string != NULL, -1);
#ifdef _g_vasprintf
len = _g_vasprintf (string, format, args);
#if !defined(HAVE_GOOD_PRINTF)
len = _g_gnulib_vasprintf (string, format, args);
if (len < 0)
*string = NULL;
#elif defined (HAVE_VASPRINTF)
len = vasprintf (string, format, args);
if (len < 0)
*string = NULL;
else if (!g_mem_is_system_malloc ())
{
/* vasprintf returns malloc-allocated memory */
gchar *string1 = g_strndup (*string, len);
free (*string);
*string = string1;
}
#else
{
va_list args2;
@ -328,3 +338,4 @@ g_vasprintf (gchar **string,

View File

@ -39,10 +39,6 @@
#define _g_vsprintf vsprintf
#define _g_vsnprintf vsnprintf
#ifdef HAVE_VASPRINTF
#define _g_vasprintf vasprintf
#endif
#else
#include "gnulib/printf.h"
@ -57,8 +53,6 @@
#define _g_vsprintf _g_gnulib_vsprintf
#define _g_vsnprintf _g_gnulib_vsnprintf
#define _g_vasprintf _g_gnulib_vasprintf
#endif
#endif /* __G_PRINTF_H__ */