Use a helper function to reduce code size; omit FILE/LINE when we have
authorOwen Taylor <otaylor@redhat.com>
Thu, 9 Sep 2004 14:42:00 +0000 (14:42 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 9 Sep 2004 14:42:00 +0000 (14:42 +0000)
Thu Sep  9 10:37:41 2004  Owen Taylor  <otaylor@redhat.com>

        * glib/gmessages.h (g_return_[val_]if_fail): Use
        a helper function to reduce code size; omit FILE/LINE
        when we have __PRETTY_FUNCTION__.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gmessages.h

index f91299f398c6bbfc1a6335ff64c6f08f761502d6..38eb64b8e278af805266eb05124df52994ba2a11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Sep  9 10:37:41 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmessages.h (g_return_[val_]if_fail): Use
+       a helper function to reduce code size; omit FILE/LINE
+       when we have __PRETTY_FUNCTION__.
+
 2004-09-09  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gutils.c (g_get_home_dir): Remove a misleading comment.
index f91299f398c6bbfc1a6335ff64c6f08f761502d6..38eb64b8e278af805266eb05124df52994ba2a11 100644 (file)
@@ -1,3 +1,9 @@
+Thu Sep  9 10:37:41 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmessages.h (g_return_[val_]if_fail): Use
+       a helper function to reduce code size; omit FILE/LINE
+       when we have __PRETTY_FUNCTION__.
+
 2004-09-09  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gutils.c (g_get_home_dir): Remove a misleading comment.
index f91299f398c6bbfc1a6335ff64c6f08f761502d6..38eb64b8e278af805266eb05124df52994ba2a11 100644 (file)
@@ -1,3 +1,9 @@
+Thu Sep  9 10:37:41 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmessages.h (g_return_[val_]if_fail): Use
+       a helper function to reduce code size; omit FILE/LINE
+       when we have __PRETTY_FUNCTION__.
+
 2004-09-09  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gutils.c (g_get_home_dir): Remove a misleading comment.
index f91299f398c6bbfc1a6335ff64c6f08f761502d6..38eb64b8e278af805266eb05124df52994ba2a11 100644 (file)
@@ -1,3 +1,9 @@
+Thu Sep  9 10:37:41 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmessages.h (g_return_[val_]if_fail): Use
+       a helper function to reduce code size; omit FILE/LINE
+       when we have __PRETTY_FUNCTION__.
+
 2004-09-09  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gutils.c (g_get_home_dir): Remove a misleading comment.
index f91299f398c6bbfc1a6335ff64c6f08f761502d6..38eb64b8e278af805266eb05124df52994ba2a11 100644 (file)
@@ -1,3 +1,9 @@
+Thu Sep  9 10:37:41 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmessages.h (g_return_[val_]if_fail): Use
+       a helper function to reduce code size; omit FILE/LINE
+       when we have __PRETTY_FUNCTION__.
+
 2004-09-09  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gutils.c (g_get_home_dir): Remove a misleading comment.
index ab76c4c443455eb003969f7630183e6813157a5f..2f8c59bf5adee7a44fb8dfac861df33b609e8541 100644 (file)
@@ -269,29 +269,26 @@ GPrintFunc      g_set_printerr_handler  (GPrintFunc      func);
 
 #ifdef __GNUC__
 
+/* Internal function, used to implement following macros */
+void g_return_if_fail_warning (const char *log_domain,
+                              const char *pretty_function,
+                              const char *expression);
+
 #define g_return_if_fail(expr)         G_STMT_START{                   \
      if G_LIKELY(expr) { } else                                        \
        {                                                               \
-        g_log (G_LOG_DOMAIN,                                           \
-               G_LOG_LEVEL_CRITICAL,                                   \
-               "file %s: line %d (%s): assertion `%s' failed",         \
-               __FILE__,                                               \
-               __LINE__,                                               \
-               __PRETTY_FUNCTION__,                                    \
-               #expr);                                                 \
+        g_return_if_fail_warning (G_LOG_DOMAIN,                        \
+                                  __PRETTY_FUNCTION__,                 \
+                                  #expr);                              \
         return;                                                        \
        };                              }G_STMT_END
 
 #define g_return_val_if_fail(expr,val) G_STMT_START{                   \
      if G_LIKELY(expr) { } else                                                \
        {                                                               \
-        g_log (G_LOG_DOMAIN,                                           \
-               G_LOG_LEVEL_CRITICAL,                                   \
-               "file %s: line %d (%s): assertion `%s' failed",         \
-               __FILE__,                                               \
-               __LINE__,                                               \
-               __PRETTY_FUNCTION__,                                    \
-               #expr);                                                 \
+        g_return_if_fail_warning (G_LOG_DOMAIN,                        \
+                                  __PRETTY_FUNCTION__,                 \
+                                  #expr);                              \
         return (val);                                                  \
        };                              }G_STMT_END