]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
2003-04-05 Havoc Pennington <hp@pobox.com>
authorHavoc Pennington <hp@redhat.com>
Sat, 5 Apr 2003 20:38:01 +0000 (20:38 +0000)
committerHavoc Pennington <hp@redhat.com>
Sat, 5 Apr 2003 20:38:01 +0000 (20:38 +0000)
* doc/config-file.txt (Elements): fix docs of <auth> to reflect
reality; in fact multiple mechanisms are allowed.

* dbus/dbus-internals.c (_dbus_real_assert)
(_dbus_real_assert_not_reached): move guts of _dbus_assert() and
_dbus_assert_not_reached() into functions, so that they don't show
up in basic block counts for test coverage, and don't use up as
much disk space. Does mean slower execution speed though, so
assumes --disable-asserts is the normal production case.

ChangeLog
dbus/dbus-internals.c
dbus/dbus-internals.h
doc/config-file.txt

index 4ac2af9632d331ff418d850b14ba3af299c753b6..fb5c8c82e0d3660afff214cb4f7fb7a0addad3ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-04-05  Havoc Pennington  <hp@pobox.com>
+
+       * doc/config-file.txt (Elements): fix docs of <auth> to reflect 
+       reality; in fact multiple mechanisms are allowed.
+
+       * dbus/dbus-internals.c (_dbus_real_assert)
+       (_dbus_real_assert_not_reached): move guts of _dbus_assert() and
+       _dbus_assert_not_reached() into functions, so that they don't show
+       up in basic block counts for test coverage, and don't use up as
+       much disk space. Does mean slower execution speed though, so
+       assumes --disable-asserts is the normal production case.
+
 2003-04-05  Havoc Pennington  <hp@pobox.com>
 
        * test/Makefile.am (dist-hook): also dist *.in files
index f1fbf9636edd45769d59fb173bce6a4ffb843dab..8d803977e0b3580f9e5ab8b677d6921fa9d94450 100644 (file)
@@ -345,6 +345,53 @@ _dbus_type_to_string (int type)
     }
 }
 
+#ifndef DBUS_DISABLE_ASSERT
+/**
+ * Internals of _dbus_assert(); it's a function
+ * rather than a macro with the inline code so
+ * that the assertion failure blocks don't show up
+ * in test suite coverage, and to shrink code size.
+ *
+ * @param condition TRUE if assertion succeeded
+ * @param condition_text condition as a string
+ * @param file file the assertion is in
+ * @param line line the assertion is in
+ */
+void
+_dbus_real_assert (dbus_bool_t  condition,
+                   const char  *condition_text,
+                   const char  *file,
+                   int          line)
+{
+  if (!condition)
+    {
+      _dbus_warn ("Assertion failed \"%s\" file \"%s\" line %d\n",
+                  condition_text, file, line);
+      _dbus_abort ();
+    }
+}
+
+/**
+ * Internals of _dbus_assert_not_reached(); it's a function
+ * rather than a macro with the inline code so
+ * that the assertion failure blocks don't show up
+ * in test suite coverage, and to shrink code size.
+ *
+ * @param explanation what was reached that shouldn't have been
+ * @param file file the assertion is in
+ * @param line line the assertion is in
+ */
+void
+_dbus_real_assert_not_reached (const char *explanation,
+                               const char *file,
+                               int         line)
+{
+  _dbus_warn ("File \"%s\" line %d should not have been reached: %s\n",
+              file, line, explanation);
+  _dbus_abort ();
+}
+#endif /* DBUS_DISABLE_ASSERT */
+  
 #ifdef DBUS_BUILD_TESTS
 static dbus_bool_t
 run_failing_each_malloc (int                    n_mallocs,
index 7e4138c934c3ca7596d57228af0dc1c2925a1f9f..dbfd068168f7ef20b9092e406cee7475be2888bd 100644 (file)
@@ -76,26 +76,22 @@ const char* _dbus_strerror (int error_number);
 #ifdef DBUS_DISABLE_ASSERT
 #define _dbus_assert(condition)
 #else
+void _dbus_real_assert (dbus_bool_t  condition,
+                        const char  *condition_text,
+                        const char  *file,
+                        int          line);
 #define _dbus_assert(condition)                                         \
-do {                                                                    \
-  if (!(condition))                                                     \
-    {                                                                   \
-      _dbus_warn ("Assertion failed \"%s\" file \"%s\" line %d\n",      \
-                  #condition, __FILE__, __LINE__);                      \
-      _dbus_abort ();                                                   \
-    }                                                                   \
-} while (0)
+  _dbus_real_assert ((condition), #condition, __FILE__, __LINE__)
 #endif /* !DBUS_DISABLE_ASSERT */
 
 #ifdef DBUS_DISABLE_ASSERT
 #define _dbus_assert_not_reached(explanation)
 #else
+void _dbus_real_assert_not_reached (const char *explanation,
+                                    const char *file,
+                                    int         line);
 #define _dbus_assert_not_reached(explanation)                                   \
-do {                                                                            \
-    _dbus_warn ("File \"%s\" line %d should not have been reached: %s\n",       \
-               __FILE__, __LINE__, (explanation));                              \
-    _dbus_abort ();                                                             \
-} while (0)
+  _dbus_real_assert_not_reached (explanation, __FILE__, __LINE__)
 #endif /* !DBUS_DISABLE_ASSERT */
 
 #define _DBUS_N_ELEMENTS(array) ((int) (sizeof ((array)) / sizeof ((array)[0])))
index 8c2152b593b0dcddc427b05db4558565745023fe..897c2380e28ff815efbd83dcd071a41c1b60e895 100644 (file)
@@ -89,7 +89,7 @@ Elements:
 
     Lists permitted authorization mechanisms. If this element doesn't
     exist, then all known mechanisms are allowed.  If there are
-    multiple <auth> elements, the last one wins (they are not merged).
+    multiple <auth> elements, all the listed mechanisms are allowed.
     The order in which mechanisms are listed is not meaningful.
     
     Example: <auth>EXTERNAL</auth>