changeset 69348:2c8e608f28e7

(USE_POSIX_MEMALIGN): New macro. (ABLOCKS_BASE, lisp_align_malloc, lisp_align_free): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 09 Mar 2006 23:06:58 +0000
parents f82697609957
children aeac9fc5787d
files src/ChangeLog src/alloc.c
diffstat 2 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Mar 09 16:51:56 2006 +0000
+++ b/src/ChangeLog	Thu Mar 09 23:06:58 2006 +0000
@@ -1,3 +1,8 @@
+2006-03-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* alloc.c (USE_POSIX_MEMALIGN): New macro.
+	(ABLOCKS_BASE, lisp_align_malloc, lisp_align_free): Use it.
+
 2006-03-09  Kenichi Handa  <handa@m17n.org>
 
 	* coding.c (DECODE_EMACS_MULE_COMPOSITION_CHAR): Fix decoding
@@ -28,10 +33,10 @@
 	(MAC_AQUA_SMALL_VERTICAL_SCROLL_BAR_WIDTH): New defines.
 
 	* macfns.c (x_default_scroll_bar_color_parameter)
-	(x_set_scroll_bar_foreground, x_set_scroll_bar_background): Remove
-	unnecessary prototypes.
-	(x_set_scroll_bar_default_width): Use
-	MAC_AQUA_VERTICAL_SCROLL_BAR_WIDTH.
+	(x_set_scroll_bar_foreground, x_set_scroll_bar_background):
+	Remove unnecessary prototypes.
+	(x_set_scroll_bar_default_width):
+	Use MAC_AQUA_VERTICAL_SCROLL_BAR_WIDTH.
 	(mac_set_scroll_bar_width): New function.
 	(mac_frame_parm_handlers): Set it as handler for scroll-bar-width.
 
@@ -57,9 +62,9 @@
 	lines, by distributing the rows evenly over the tool-bar screen	area.
 	(Vtool_bar_border): New variable.
 	(syms_of_xdisp): DEFVAR_LISP it.
-	(display_tool_bar_line): Add HEIGHT arg for desired row height.  Make
-	tool-bar row the desired height.  Use default face for border below
-	tool-bar.
+	(display_tool_bar_line): Add HEIGHT arg for desired row height.
+	Make tool-bar row the desired height.  Use default face for border
+	below tool-bar.
 	(tool_bar_lines_needed): Add N_ROWS arg.  Use it to return number of
 	actual tool-bar rows.
 	(redisplay_tool_bar): Calculate f->n_tool_bar_rows initially.
@@ -86,8 +91,7 @@
 
 2006-02-26  Chong Yidong  <cyd@stupidchicken.com>
 
-	* xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary
-	argument.
+	* xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary argument.
 
 	* xterm.c: (x_load_font, x_term_init, XTmouse_position)
 	(handle_one_xevent, x_connection_closed, x_list_fonts): No arg for
--- a/src/alloc.c	Thu Mar 09 16:51:56 2006 +0000
+++ b/src/alloc.c	Thu Mar 09 23:06:58 2006 +0000
@@ -883,6 +883,10 @@
 /* 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).  */
+#define USE_POSIX_MEMALIGN (HAVE_POSIX_MEMALIGN && SYSTEM_MALLOC)
 
 /* BLOCK_ALIGN has to be a power of 2.  */
 #define BLOCK_ALIGN (1 << 10)
@@ -948,7 +952,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) \
@@ -989,7 +993,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)
@@ -1105,7 +1109,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));