_dbus_assert (i < MAX_MESSAGE_CACHE_SIZE);
_dbus_assert (message != NULL);
- _dbus_assert (message->refcount.value == 0);
+ _dbus_assert (_dbus_atomic_get (&message->refcount) == 0);
+
_dbus_assert (message->counters == NULL);
_DBUS_UNLOCK (message_cache);
{
dbus_bool_t was_cached;
int i;
-
- _dbus_assert (message->refcount.value == 0);
+
+ _dbus_assert (_dbus_atomic_get (&message->refcount) == 0);
/* This calls application code and has to be done first thing
* without holding the lock
#endif
out:
- _dbus_assert (message->refcount.value == 0);
-
+ _dbus_assert (_dbus_atomic_get (&message->refcount) == 0);
+
_DBUS_UNLOCK (message_cache);
if (!was_cached)
static void
dbus_message_finalize (DBusMessage *message)
{
- _dbus_assert (message->refcount.value == 0);
+ _dbus_assert (_dbus_atomic_get (&message->refcount) == 0);
/* This calls application callbacks! */
_dbus_data_slot_list_free (&message->slot_list);
dbus_free(message->unix_fds);
#endif
- _dbus_assert (message->refcount.value == 0);
-
+ _dbus_assert (_dbus_atomic_get (&message->refcount) == 0);
+
dbus_free (message);
}
else
{
from_cache = FALSE;
- message = dbus_new (DBusMessage, 1);
+ message = dbus_new0 (DBusMessage, 1);
if (message == NULL)
return NULL;
#ifndef DBUS_DISABLE_CHECKS
message->n_unix_fds_allocated = 0;
#endif
}
-
- message->refcount.value = 1;
+
+ _dbus_atomic_inc (&message->refcount);
+
message->byte_order = DBUS_COMPILER_BYTE_ORDER;
message->locked = FALSE;
#ifndef DBUS_DISABLE_CHECKS
if (retval == NULL)
return NULL;
- retval->refcount.value = 1;
+ _dbus_atomic_inc (&retval->refcount);
retval->byte_order = message->byte_order;
retval->locked = FALSE;
#ifndef DBUS_DISABLE_CHECKS