diff src/alloc.c @ 83490:0cdee8b991e1

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-144 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-145 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-146 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-147 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-148 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-149 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-150 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-151 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-152 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-56 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-57 Copy/update icons from Gnus trunk git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-530
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 12 Mar 2006 04:51:49 +0000
parents d08a7ef0cb8a a685fca1ccb6
children 81f2d90dee68
line wrap: on
line diff
--- a/src/alloc.c	Sun Mar 12 04:16:48 2006 +0000
+++ b/src/alloc.c	Sun Mar 12 04:51:49 2006 +0000
@@ -885,6 +885,12 @@
 /* The entry point is lisp_align_malloc which returns blocks of at most    */
 /* BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary.  */
 
+/* Use posix_memalloc if the system has it and we're using the system's
+   malloc (because our gmalloc.c routines don't have posix_memalign although
+   its memalloc could be used).  */
+#if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC)
+#define USE_POSIX_MEMALIGN 1
+#endif
 
 /* BLOCK_ALIGN has to be a power of 2.  */
 #define BLOCK_ALIGN (1 << 10)
@@ -950,7 +956,7 @@
 #define ABLOCKS_BUSY(abase) ((abase)->blocks[0].abase)
 
 /* Pointer to the (not necessarily aligned) malloc block.  */
-#ifdef HAVE_POSIX_MEMALIGN
+#ifdef USE_POSIX_MEMALIGN
 #define ABLOCKS_BASE(abase) (abase)
 #else
 #define ABLOCKS_BASE(abase) \
@@ -991,7 +997,7 @@
       mallopt (M_MMAP_MAX, 0);
 #endif
 
-#ifdef HAVE_POSIX_MEMALIGN
+#ifdef USE_POSIX_MEMALIGN
       {
 	int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES);
 	if (err)
@@ -1107,7 +1113,7 @@
 	}
       eassert ((aligned & 1) == aligned);
       eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1));
-#ifdef HAVE_POSIX_MEMALIGN
+#ifdef USE_POSIX_MEMALIGN
       eassert ((unsigned long)ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0);
 #endif
       free (ABLOCKS_BASE (abase));