+2004-11-26 Havoc Pennington <hp@redhat.com>
+
+ * dbus/dbus-message.c (dbus_message_cache_or_finalize): fix bug
+ where I was trying to cache one too many messages
+
2004-11-26 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message.c: reimplement message cache as an array which
return NULL;
}
+ /* This is not necessarily true unless count > 0, and
+ * message_cache is uninitialized until the shutdown is
+ * registered
+ */
+ _dbus_assert (message_cache_shutdown_registered);
+
i = 0;
while (i < MAX_MESSAGE_CACHE_SIZE)
{
}
++i;
}
+ _dbus_assert (message_cache_count >= 0);
_dbus_assert (i < MAX_MESSAGE_CACHE_SIZE);
_dbus_assert (message != NULL);
MAX_MESSAGE_SIZE_TO_CACHE)
goto out;
- if (message_cache_count > MAX_MESSAGE_CACHE_SIZE)
+ if (message_cache_count >= MAX_MESSAGE_CACHE_SIZE)
goto out;
+ /* Find empty slot */
i = 0;
while (message_cache[i] != NULL)
- {
- ++i;
- _dbus_assert (i < MAX_MESSAGE_CACHE_SIZE);
- }
+ ++i;
+
+ _dbus_assert (i < MAX_MESSAGE_CACHE_SIZE);
_dbus_assert (message_cache[i] == NULL);
message_cache[i] = message;