summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-mempool.c
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@codefactory.se>2003-02-19 16:23:41 +0000
committerAnders Carlsson <andersca@codefactory.se>2003-02-19 16:23:41 +0000
commit89ee9e6abf40b594c681479dfc4d18d892c93838 (patch)
tree368712eacf6904e71fa0da86674a557120190cac /dbus/dbus-mempool.c
parent90c4578863d9b42db9e27875dbd4135b9e2cd6c7 (diff)
2003-02-19 Anders Carlsson <andersca@codefactory.se>
* configure.in: Add check for nonposix getpwnam_r * dbus/dbus-mempool.c: (_dbus_mem_pool_new): Align the pool element size to a sizeof (void *) boundary. * dbus/dbus-sysdeps.c: (_dbus_setenv), (_dbus_connect_unix_socket), (_dbus_listen_unix_socket), (_dbus_credentials_from_username): General Solaris fixes. * test/data/valid-messages/simplest-manual.message: Explicitly state that we want little-endian packing.
Diffstat (limited to 'dbus/dbus-mempool.c')
-rw-r--r--dbus/dbus-mempool.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/dbus/dbus-mempool.c b/dbus/dbus-mempool.c
index 3b233dd1..0d62e62b 100644
--- a/dbus/dbus-mempool.c
+++ b/dbus/dbus-mempool.c
@@ -144,17 +144,20 @@ _dbus_mem_pool_new (int element_size,
*/
_dbus_assert (element_size >= (int) sizeof (void*));
_dbus_assert (element_size >= (int) sizeof (DBusFreedElement));
-
- pool->element_size = element_size;
+
+ /* align the element size to a pointer boundary so we won't get bus
+ * errors under other architectures.
+ */
+ pool->element_size = _DBUS_ALIGN_VALUE (element_size, sizeof (void *));
+
pool->zero_elements = zero_elements != FALSE;
/* pick a size for the first block; it increases
* for each block we need to allocate. This is
* actually half the initial block size
* since _dbus_mem_pool_alloc() unconditionally
- * doubles it prior to creating a new block.
- */
- pool->block_size = element_size * 8;
+ * doubles it prior to creating a new block. */
+ pool->block_size = pool->element_size * 8;
_dbus_assert ((pool->block_size %
pool->element_size) == 0);