2003-01-25 Anders Carlsson <andersca@codefactory.se>
+ * dbus/dbus-list.c: (alloc_link), (free_link):
+ Use a memory pool for the links.
+
+2003-01-25 Anders Carlsson <andersca@codefactory.se>
+
* bus/connection.c: (bus_connection_foreach):
* bus/connection.h:
Add new bus_connection_foreach function.
#include "dbus-internals.h"
#include "dbus-list.h"
+#include "dbus-mempool.h"
/**
* @defgroup DBusList Linked list
* Types and functions related to DBusList.
*/
+static DBusMemPool *list_pool;
+
/**
* @defgroup DBusListInternals Linked list implementation details
* @ingroup DBusInternals
*
* The guts of DBusList.
*
- * @todo should use a memory pool for the list nodes, to avoid
- * a memory allocation for every link.
* @{
*/
{
DBusList *link;
- link = dbus_new0 (DBusList, 1);
+ if (!list_pool)
+ list_pool = _dbus_mem_pool_new (sizeof (DBusList), TRUE);
+
+ link = _dbus_mem_pool_alloc (list_pool);
link->data = data;
return link;
static void
free_link (DBusList *link)
{
- dbus_free (link);
+ _dbus_mem_pool_dealloc (list_pool, link);
}
static void