Cleanup: simplify assertion check

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
Chengwei Yang 2013-08-23 16:57:30 +08:00 committed by Simon McVittie
parent fa783ea4ea
commit 8203fe35da
2 changed files with 5 additions and 19 deletions

View 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++)
{

View 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,