From 9bba11ef79f33de7824ef81f35448f10e4b2b91a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 14 Jul 2011 17:14:29 +0100 Subject: [PATCH 6/9] dbus_message_ref: avoid unused variable if not asserting --- dbus/dbus-message.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index d62529c..a6426ba 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1519,14 +1519,20 @@ dbus_message_copy (const DBusMessage *message) DBusMessage * dbus_message_ref (DBusMessage *message) { +#ifndef DBUS_DISABLE_ASSERT dbus_int32_t old_refcount; +#endif _dbus_return_val_if_fail (message != NULL, NULL); _dbus_return_val_if_fail (message->generation == _dbus_current_generation, NULL); _dbus_return_val_if_fail (!message->in_cache, NULL); - + +#ifdef DBUS_DISABLE_ASSERT + _dbus_atomic_inc (&message->refcount); +#else old_refcount = _dbus_atomic_inc (&message->refcount); _dbus_assert (old_refcount >= 1); +#endif return message; } -- 1.7.5.4