From 0e5ba41d15de42487b565967e79623625423f0df Mon Sep 17 00:00:00 2001 From: david Date: Tue, 13 Nov 2007 01:17:39 +0000 Subject: [PATCH] Align blocks to 2 * sizeof(size_t) in charpool.c. This is what Glibc's malloc does. --- charpool.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/charpool.cc b/charpool.cc index 9dcbccecf..9dbce0f90 100644 --- a/charpool.cc +++ b/charpool.cc @@ -99,6 +99,8 @@ /* $Id$ */ +#include + #include "nbase.h" /* Character pool memory allocation */ @@ -110,7 +112,10 @@ static int currentcharpool; static int currentcharpoolsz; static char *nextchar; -#define ALIGN_ON sizeof(char *) +/* Allocated blocks are allocated to multiples of ALIGN_ON. This is the + definition used by the malloc in Glibc 2.7, which says that it "suffices for + nearly all current machines and C compilers." */ +#define ALIGN_ON (2 * sizeof(size_t)) static int cp_init(void) { static int charpool_initialized = 0;