From f1ca9b89e92de4d876dc5e7e85710c4d2dc87638 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 17 Oct 2006 20:52:13 +0000 Subject: 2006-10-17 Havoc Pennington * dbus/dbus-internals.c (_dbus_warn_check_failed): new function to be used for return_if_fail type warnings; prefixes the pid, and fatal by default. --- dbus/dbus-internals.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'dbus/dbus-internals.h') diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 204ac1f9..3c8750e9 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -42,6 +42,10 @@ DBUS_BEGIN_DECLS void _dbus_warn (const char *format, ...) _DBUS_GNUC_PRINTF (1, 2); +void _dbus_warn_check_failed (const char *format, + ...) _DBUS_GNUC_PRINTF (1, 2); + + #if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) #define _DBUS_FUNCTION_NAME __func__ #elif defined(__GNUC__) @@ -129,19 +133,19 @@ void _dbus_real_assert_not_reached (const char *explanation, #else extern const char _dbus_return_if_fail_warning_format[]; -#define _dbus_return_if_fail(condition) do { \ - _dbus_assert ((*(const char*)_DBUS_FUNCTION_NAME) != '_'); \ - if (!(condition)) { \ - _dbus_warn (_dbus_return_if_fail_warning_format, \ - _dbus_getpid (), _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \ - return; \ +#define _dbus_return_if_fail(condition) do { \ + _dbus_assert ((*(const char*)_DBUS_FUNCTION_NAME) != '_'); \ + if (!(condition)) { \ + _dbus_warn_check_failed (_dbus_return_if_fail_warning_format, \ + _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \ + return; \ } } while (0) #define _dbus_return_val_if_fail(condition, val) do { \ _dbus_assert ((*(const char*)_DBUS_FUNCTION_NAME) != '_'); \ if (!(condition)) { \ - _dbus_warn (_dbus_return_if_fail_warning_format, \ - _dbus_getpid (), _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \ + _dbus_warn_check_failed (_dbus_return_if_fail_warning_format, \ + _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \ return (val); \ } } while (0) -- cgit