Cleanup: simplify assertion check
authorChengwei Yang <chengwei.yang@intel.com>
Fri, 23 Aug 2013 08:57:30 +0000 (16:57 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 23 Aug 2013 10:54:34 +0000 (11:54 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/driver.c
dbus/dbus-string.c

index 23197e4..e95a79d 100644 (file)
@@ -885,13 +885,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
   /* The message signature has already been checked for us,
    * so let's just assert it's right.
    */
-#ifndef DBUS_DISABLE_ASSERT
-    {
-      int msg_type = dbus_message_iter_get_arg_type (&iter);
-
-      _dbus_assert (msg_type == DBUS_TYPE_ARRAY);
-    }
-#endif
+  _dbus_assert (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY);
 
   dbus_message_iter_recurse (&iter, &dict_iter);
 
@@ -2008,13 +2002,8 @@ bus_driver_handle_message (DBusConnection *connection,
   _dbus_verbose ("Driver got a method call: %s\n", name);
 
   /* security checks should have kept this from getting here */
-#ifndef DBUS_DISABLE_ASSERT
-    {
-      const char *sender = dbus_message_get_sender (message);
-
-      _dbus_assert (sender != NULL || strcmp (name, "Hello") == 0);
-    }
-#endif
+  _dbus_assert (dbus_message_get_sender (message) != NULL ||
+                strcmp (name, "Hello") == 0);
 
   for (ih = interface_handlers; ih->name != NULL; ih++)
     {
index 18e87eb..81140a6 100644 (file)
@@ -335,14 +335,11 @@ reallocate_for_length (DBusRealString *real,
    * disable asserts to profile, you don't get this destroyer
    * of profiles.
    */
-#ifdef DBUS_DISABLE_ASSERT
-#else
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
+#if defined (DBUS_ENABLE_EMBEDDED_TESTS) && !defined (DBUS_DISABLE_ASSERT)
   new_allocated = 0; /* ensure a realloc every time so that we go
                       * through all malloc failure codepaths
                       */
-#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
-#endif /* !DBUS_DISABLE_ASSERT */
+#endif
 
   /* But be sure we always alloc at least space for the new length */
   new_allocated = MAX (new_allocated,