mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Use g_strndup, not g_strdup, since we know the length in advance.
2003-02-26 Matthias Clasen <maclas@gmx.de> * glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not g_strdup, since we know the length in advance.
This commit is contained in:
parent
98fefa5b5f
commit
6f98877728
@ -1,5 +1,8 @@
|
|||||||
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not
|
||||||
|
g_strdup, since we know the length in advance.
|
||||||
|
|
||||||
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
||||||
g_malloc instead of directly using malloc.
|
g_malloc instead of directly using malloc.
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not
|
||||||
|
g_strdup, since we know the length in advance.
|
||||||
|
|
||||||
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
||||||
g_malloc instead of directly using malloc.
|
g_malloc instead of directly using malloc.
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not
|
||||||
|
g_strdup, since we know the length in advance.
|
||||||
|
|
||||||
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
||||||
g_malloc instead of directly using malloc.
|
g_malloc instead of directly using malloc.
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not
|
||||||
|
g_strdup, since we know the length in advance.
|
||||||
|
|
||||||
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
||||||
g_malloc instead of directly using malloc.
|
g_malloc instead of directly using malloc.
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not
|
||||||
|
g_strdup, since we know the length in advance.
|
||||||
|
|
||||||
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
||||||
g_malloc instead of directly using malloc.
|
g_malloc instead of directly using malloc.
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
2003-02-26 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_strdup_vprintf): Use g_strndup, not
|
||||||
|
g_strdup, since we know the length in advance.
|
||||||
|
|
||||||
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
* glib/gunidecomp.c (g_unicode_canonical_decomposition): Use
|
||||||
g_malloc instead of directly using malloc.
|
g_malloc instead of directly using malloc.
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* do not include <unistd.h> in this place since it
|
/* do not include <unistd.h> in this place since it
|
||||||
* inteferes with g_strsignal() on some OSes
|
* interferes with g_strsignal() on some OSes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const guint16 ascii_table_data[256] = {
|
static const guint16 ascii_table_data[256] = {
|
||||||
@ -183,11 +183,13 @@ g_strdup_vprintf (const gchar *format,
|
|||||||
{
|
{
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
#ifdef HAVE_VASPRINTF
|
#ifdef HAVE_VASPRINTF
|
||||||
if (_g_vasprintf (&buffer, format, args1) < 0)
|
gint len;
|
||||||
|
len = _g_vasprintf (&buffer, format, args1);
|
||||||
|
if (len < 0)
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
else if (!g_mem_is_system_malloc ())
|
else if (!g_mem_is_system_malloc ())
|
||||||
{
|
{
|
||||||
gchar *buffer1 = g_strdup (buffer);
|
gchar *buffer1 = g_strndup (buffer, len);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
buffer = buffer1;
|
buffer = buffer1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user