handle NULL arguments gracefully.
authorTim Janik <timj@gtk.org>
Thu, 27 Nov 2003 17:08:58 +0000 (17:08 +0000)
committerTim Janik <timj@src.gnome.org>
Thu, 27 Nov 2003 17:08:58 +0000 (17:08 +0000)
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).

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gmacros.h
glib/gstrfuncs.c

index c571912..3e1eada 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index c571912..3e1eada 100644 (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
index c571912..3e1eada 100644 (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
index c571912..3e1eada 100644 (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
index c571912..3e1eada 100644 (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
index c571912..3e1eada 100644 (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
index 7315445..7b61b82 100644 (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__
 #  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" {
index a4d6b17..e166212 100644 (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);