From bc86794f23fa538a405813fb61b531c2eacc9ae1 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 31 Mar 2003 04:01:00 +0000 Subject: 2003-03-30 Havoc Pennington * bus/config-parser.c: hacking * dbus/dbus-memory.c: don't use DBusList for the list of stuff to shut down, since it could cause weirdness with the DBusList lock * dbus/dbus-list.c (_dbus_list_test): add tests for the link-oriented stack routines (alloc_link): free the mempool if the first alloc from it fails * dbus/dbus-mempool.c (struct DBusMemBlock): fix alignment issue * dbus/dbus-string.c (UNICODE_VALID): sync new version of this from GLib (_dbus_string_skip_white): new * doc/config-file.txt (Elements): add --- dbus/dbus-mempool.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'dbus/dbus-mempool.c') diff --git a/dbus/dbus-mempool.c b/dbus/dbus-mempool.c index 13ba5502..5074c7d2 100644 --- a/dbus/dbus-mempool.c +++ b/dbus/dbus-mempool.c @@ -84,7 +84,8 @@ struct DBusMemBlock * when we free the mem pool. */ - int used_so_far; /**< bytes of this block already allocated as elements. */ + /* this is a long so that "elements" is aligned */ + long used_so_far; /**< bytes of this block already allocated as elements. */ unsigned char elements[ELEMENT_PADDING]; /**< the block data, actually allocated to required size */ }; @@ -254,7 +255,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool) memset (element, '\0', pool->element_size); pool->allocated_elements += 1; - + return element; } else @@ -311,11 +312,11 @@ _dbus_mem_pool_alloc (DBusMemPool *pool) } element = &pool->blocks->elements[pool->blocks->used_so_far]; - + pool->blocks->used_so_far += pool->element_size; pool->allocated_elements += 1; - + return element; } } -- cgit