mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 17:26:17 +01:00
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:
parent
059b48dd84
commit
495377c45e
12
ChangeLog
12
ChangeLog
@ -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>
|
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
|
||||||
|
|
||||||
* NEWS: Fix a typo in my name
|
* NEWS: Fix a typo in my name
|
||||||
|
@ -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>
|
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
|
||||||
|
|
||||||
* NEWS: Fix a typo in my name
|
* NEWS: Fix a typo in my name
|
||||||
|
@ -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>
|
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
|
||||||
|
|
||||||
* NEWS: Fix a typo in my name
|
* NEWS: Fix a typo in my name
|
||||||
|
@ -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>
|
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
|
||||||
|
|
||||||
* NEWS: Fix a typo in my name
|
* NEWS: Fix a typo in my name
|
||||||
|
@ -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>
|
2004-07-20 Crispin Flowerday <gnome@flowerday.cx>
|
||||||
|
|
||||||
* NEWS: Fix a typo in my name
|
* NEWS: Fix a typo in my name
|
||||||
|
@ -300,17 +300,27 @@ 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 _g_vasprintf
|
#if !defined(HAVE_GOOD_PRINTF)
|
||||||
len = _g_vasprintf (string, format, args);
|
|
||||||
|
len = _g_gnulib_vasprintf (string, format, args);
|
||||||
|
if (len < 0)
|
||||||
|
*string = NULL;
|
||||||
|
|
||||||
|
#elif defined (HAVE_VASPRINTF)
|
||||||
|
|
||||||
|
len = vasprintf (string, format, args);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
*string = NULL;
|
*string = NULL;
|
||||||
else if (!g_mem_is_system_malloc ())
|
else if (!g_mem_is_system_malloc ())
|
||||||
{
|
{
|
||||||
|
/* vasprintf returns malloc-allocated memory */
|
||||||
gchar *string1 = g_strndup (*string, len);
|
gchar *string1 = g_strndup (*string, len);
|
||||||
free (*string);
|
free (*string);
|
||||||
*string = string1;
|
*string = string1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
{
|
{
|
||||||
va_list args2;
|
va_list args2;
|
||||||
|
|
||||||
@ -328,3 +338,4 @@ g_vasprintf (gchar **string,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +39,6 @@
|
|||||||
#define _g_vsprintf vsprintf
|
#define _g_vsprintf vsprintf
|
||||||
#define _g_vsnprintf vsnprintf
|
#define _g_vsnprintf vsnprintf
|
||||||
|
|
||||||
#ifdef HAVE_VASPRINTF
|
|
||||||
#define _g_vasprintf vasprintf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "gnulib/printf.h"
|
#include "gnulib/printf.h"
|
||||||
@ -57,8 +53,6 @@
|
|||||||
#define _g_vsprintf _g_gnulib_vsprintf
|
#define _g_vsprintf _g_gnulib_vsprintf
|
||||||
#define _g_vsnprintf _g_gnulib_vsnprintf
|
#define _g_vsnprintf _g_gnulib_vsnprintf
|
||||||
|
|
||||||
#define _g_vasprintf _g_gnulib_vasprintf
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __G_PRINTF_H__ */
|
#endif /* __G_PRINTF_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user