handle NULL arguments gracefully.

Thu Nov 27 17:04:08 2003  Tim Janik  <timj@gtk.org>

        * glib/gstrfuncs.c (g_strconcat): handle NULL arguments
        gracefully.

        * glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
        current function (since G_STRLOC and G_GNUC_*FUNCTION became
        unusable with gcc-3.0).
This commit is contained in:
Tim Janik 2003-11-27 17:08:58 +00:00 committed by Tim Janik
parent 0642df0ab3
commit 5d49a7caf7
8 changed files with 66 additions and 1 deletions

View File

@ -1,3 +1,12 @@
Thu Nov 27 17:04:08 2003 Tim Janik <timj@gtk.org>
* glib/gstrfuncs.c (g_strconcat): handle NULL arguments
gracefully.
* glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
current function (since G_STRLOC and G_GNUC_*FUNCTION became
unusable with gcc-3.0).
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
* glib/gstrfuncs.c: Fixed a bad pointer comparison in

View File

@ -1,3 +1,12 @@
Thu Nov 27 17:04:08 2003 Tim Janik <timj@gtk.org>
* glib/gstrfuncs.c (g_strconcat): handle NULL arguments
gracefully.
* glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
current function (since G_STRLOC and G_GNUC_*FUNCTION became
unusable with gcc-3.0).
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
* glib/gstrfuncs.c: Fixed a bad pointer comparison in

View File

@ -1,3 +1,12 @@
Thu Nov 27 17:04:08 2003 Tim Janik <timj@gtk.org>
* glib/gstrfuncs.c (g_strconcat): handle NULL arguments
gracefully.
* glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
current function (since G_STRLOC and G_GNUC_*FUNCTION became
unusable with gcc-3.0).
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
* glib/gstrfuncs.c: Fixed a bad pointer comparison in

View File

@ -1,3 +1,12 @@
Thu Nov 27 17:04:08 2003 Tim Janik <timj@gtk.org>
* glib/gstrfuncs.c (g_strconcat): handle NULL arguments
gracefully.
* glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
current function (since G_STRLOC and G_GNUC_*FUNCTION became
unusable with gcc-3.0).
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
* glib/gstrfuncs.c: Fixed a bad pointer comparison in

View File

@ -1,3 +1,12 @@
Thu Nov 27 17:04:08 2003 Tim Janik <timj@gtk.org>
* glib/gstrfuncs.c (g_strconcat): handle NULL arguments
gracefully.
* glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
current function (since G_STRLOC and G_GNUC_*FUNCTION became
unusable with gcc-3.0).
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
* glib/gstrfuncs.c: Fixed a bad pointer comparison in

View File

@ -1,3 +1,12 @@
Thu Nov 27 17:04:08 2003 Tim Janik <timj@gtk.org>
* glib/gstrfuncs.c (g_strconcat): handle NULL arguments
gracefully.
* glib/gmacros.h: defined G_STRFUNC, which (pretty) prints the
current function (since G_STRLOC and G_GNUC_*FUNCTION became
unusable with gcc-3.0).
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
* glib/gstrfuncs.c: Fixed a bad pointer comparison in

View File

@ -88,6 +88,7 @@
/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
* macros, so we can refer to them as strings unconditionally.
* usage not-recommended since gcc-3.0
*/
#if defined (__GNUC__) && (__GNUC__ < 3)
#define G_GNUC_FUNCTION __FUNCTION__
@ -107,6 +108,15 @@
# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
#endif
/* Provide a string identifying the current function, non-concatenatable */
#if defined (__GNUC__)
# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
#elif defined (G_HAVE_ISO_VARARGS)
# define G_STRFUNC ((const char*) (__func__))
#elif
# define G_STRFUNC ((const char*) ("???"))
#endif
/* Guard C code in headers, while including them from C++ */
#ifdef __cplusplus
# define G_BEGIN_DECLS extern "C" {

View File

@ -214,7 +214,8 @@ g_strconcat (const gchar *string1, ...)
gchar *concat;
gchar *ptr;
g_return_val_if_fail (string1 != NULL, NULL);
if (!string1)
return NULL;
l = 1 + strlen (string1);
va_start (args, string1);