From 4b23d082291f7803e20b1f808d24b42de8d5a975 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 25 Feb 2015 10:36:03 +0100 Subject: [PATCH] Fix warning: 'the comparison will always evaluate as 'false' for the address of '....' will never be NULL [-Waddress]' --- dbus/dbus-internals.c | 14 ++++++++++++++ dbus/dbus-internals.h | 9 +++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 92a108c..2f03c1e 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -1051,4 +1051,18 @@ _dbus_test_oom_handling (const char *description, } #endif /* DBUS_ENABLE_EMBEDDED_TESTS */ +#ifndef DBUS_DISABLE_CHECKS + +void _dbus_assert_error_is_set(DBusError *error) +{ + _dbus_assert (error == NULL || dbus_error_is_set (error)); +} + +void _dbus_assert_error_is_clear(DBusError *error) +{ + _dbus_assert (error == NULL || !dbus_error_is_set (error)); +} + +#endif /* DBUS_DISABLE_CHECKS */ + /** @} */ diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index d394680..99e94e3 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -202,8 +202,13 @@ extern const char *_dbus_return_if_fail_warning_format; #define _DBUS_ASSERT_ERROR_IS_SET(error) do { } while (0) #define _DBUS_ASSERT_ERROR_IS_CLEAR(error) do { } while (0) #else -#define _DBUS_ASSERT_ERROR_IS_SET(error) _dbus_assert ((error) == NULL || dbus_error_is_set ((error))) -#define _DBUS_ASSERT_ERROR_IS_CLEAR(error) _dbus_assert ((error) == NULL || !dbus_error_is_set ((error))) +DBUS_PRIVATE_EXPORT +void _dbus_assert_error_is_set(DBusError *error); +DBUS_PRIVATE_EXPORT +void _dbus_assert_error_is_clear(DBusError *error); + +#define _DBUS_ASSERT_ERROR_IS_SET(error) _dbus_assert_error_is_set(error) +#define _DBUS_ASSERT_ERROR_IS_CLEAR(error) _dbus_assert_error_is_clear(error) #endif #define _dbus_return_if_error_is_set(error) _dbus_return_if_fail ((error) == NULL || !dbus_error_is_set ((error))) -- 1.8.4.5