summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-03-12 04:51:49 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-03-12 04:51:49 +0000
commita6b6d0863c1b96e14ba3a2d1b9c941fbbcc8adf2 (patch)
treeab087c9b03ec98c1648cb02b4ee49096a1052e44 /src/alloc.c
parent33780b9521e3a416283b46dcd7e3ebb84bbffd67 (diff)
parent8cf1c5a44266bbd0f9919e854deee1d7361facd1 (diff)
downloademacs-a6b6d0863c1b96e14ba3a2d1b9c941fbbcc8adf2.tar.gz
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
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 74c3c66173a..259143ffad8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -885,6 +885,12 @@ lisp_free (block)
/* 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 @@ struct ablocks
#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 @@ lisp_align_malloc (nbytes, type)
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 @@ lisp_align_free (block)
}
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));