summaryrefslogtreecommitdiffstats
path: root/generic/tclAlloc.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2007-12-17 15:28:25 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2007-12-17 15:28:25 (GMT)
commit5839e20e37267d1257342d2850e98b3ba1123cf0 (patch)
tree49d9048cda9d5fbd98c4370922f050be7ee89dfe /generic/tclAlloc.c
parent30ac6357580feb97c6b19c49d1aa724e32a3faf8 (diff)
downloadtcl-5839e20e37267d1257342d2850e98b3ba1123cf0.zip
tcl-5839e20e37267d1257342d2850e98b3ba1123cf0.tar.gz
tcl-5839e20e37267d1257342d2850e98b3ba1123cf0.tar.bz2
* generic/tclAlloc.c:
* generic/tclExecute.c: * generic/tclInt.h: * generic/tclThreadAlloc.c: Fix alignment for memory returned by TclStackAlloc; insure that all memory allocators align to 16-byte boundaries on 64 bit platforms [Bug 1851832, 1851524]
Diffstat (limited to 'generic/tclAlloc.c')
-rw-r--r--generic/tclAlloc.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index 35524fd..de21c7c 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAlloc.c,v 1.26 2007/12/13 15:23:14 dgp Exp $
+ * RCS: @(#) $Id: tclAlloc.c,v 1.27 2007/12/17 15:28:27 msofer Exp $
*/
/*
@@ -44,16 +44,6 @@ typedef unsigned long caddr_t;
#endif
/*
- * Alignment for allocated memory.
- */
-
-#if defined(__APPLE__)
-#define ALLOCALIGN 16
-#else
-#define ALLOCALIGN 8
-#endif
-
-/*
* The overhead on a block is at least 8 bytes. When free, this space contains
* a pointer to the next free block, and the bottom two bits must be zero.
* When in use, the first byte is set to MAGIC, and the second byte is the
@@ -66,7 +56,7 @@ typedef unsigned long caddr_t;
union overhead {
union overhead *next; /* when free */
- unsigned char padding[ALLOCALIGN]; /* align struct to ALLOCALIGN bytes */
+ unsigned char padding[TCL_ALLOCALIGN]; /* align struct to TCL_ALLOCALIGN bytes */
struct {
unsigned char magic0; /* magic number */
unsigned char index; /* bucket # */
@@ -110,7 +100,7 @@ union overhead {
* precedes the data area returned to the user.
*/
-#define MINBLOCK ((sizeof(union overhead) + (ALLOCALIGN-1)) & ~(ALLOCALIGN-1))
+#define MINBLOCK ((sizeof(union overhead) + (TCL_ALLOCALIGN-1)) & ~(TCL_ALLOCALIGN-1))
#define NBUCKETS (13 - (MINBLOCK >> 4))
#define MAXMALLOC (1<<(NBUCKETS+2))
static union overhead *nextf[NBUCKETS];