From: Stefan Monnier Date: Thu, 9 Mar 2006 23:06:58 +0000 (+0000) Subject: (USE_POSIX_MEMALIGN): New macro. X-Git-Tag: emacs-pretest-22.0.90~3727 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=349a450079672dcf0cb5bffb40feb388fa6879c9;p=emacs.git (USE_POSIX_MEMALIGN): New macro. (ABLOCKS_BASE, lisp_align_malloc, lisp_align_free): Use it. --- diff --git a/src/ChangeLog b/src/ChangeLog index 6cf09be70fd..0a9d21b0c9b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-03-09 Stefan Monnier + + * alloc.c (USE_POSIX_MEMALIGN): New macro. + (ABLOCKS_BASE, lisp_align_malloc, lisp_align_free): Use it. + 2006-03-09 Kenichi Handa * 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 - * 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 diff --git a/src/alloc.c b/src/alloc.c index bb5f550d175..ee84bd2fb29 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -883,6 +883,10 @@ 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). */ +#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 @@ 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) \ @@ -989,7 +993,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) @@ -1105,7 +1109,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));