From cb41b32a2325b0bd6e12d62cc82f2bc6dd00047a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Nov 2011 13:12:10 -0800 Subject: Fix some portability problems with 'inline'. * dispextern.h (window_box, window_box_height, window_text_bottom_y) (window_box_width, window_box_left, window_box_left_offset) (window_box_right, window_box_right_offset): Declare extern. Otherwise, these inline functions do not conform to C99 and are miscompiled by Microsoft compilers. Reported by Eli Zaretskii in . * intervals.c (adjust_intervals_for_insertion) (adjust_intervals_for_deletion): Now extern, because otherwise the extern inline functions 'offset_intervals' couldn't refer to it. (static_offset_intervals): Remove. (offset_intervals): Rewrite using the old contents of static_offset_intervals. The old version didn't conform to C99 because an extern inline function contained a reference to an identifier with static linkage. --- src/dispextern.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/dispextern.h') diff --git a/src/dispextern.h b/src/dispextern.h index 5c60a5499da..fdc7f2f908d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3006,14 +3006,14 @@ int resize_mini_window (struct window *, int); void set_vertical_scroll_bar (struct window *); #endif int try_window (Lisp_Object, struct text_pos, int); -void window_box (struct window *, int, int *, int *, int *, int *); -int window_box_height (struct window *); -int window_text_bottom_y (struct window *); -int window_box_width (struct window *, int); -int window_box_left (struct window *, int); -int window_box_left_offset (struct window *, int); -int window_box_right (struct window *, int); -int window_box_right_offset (struct window *, int); +extern void window_box (struct window *, int, int *, int *, int *, int *); +extern int window_box_height (struct window *); +extern int window_text_bottom_y (struct window *); +extern int window_box_width (struct window *, int); +extern int window_box_left (struct window *, int); +extern int window_box_left_offset (struct window *, int); +extern int window_box_right (struct window *, int); +extern int window_box_right_offset (struct window *, int); int estimate_mode_line_height (struct frame *, enum face_id); void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, NativeRectangle *, int); -- cgit v1.2.1 From 09db192c23bc7205341a075b41d101a7bdf786ed Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Nov 2011 12:05:27 -0800 Subject: Avoid some portability problems by eschewing 'extern inline' functions. The trivial performance wins aren't worth the portability hassles; see et seq. * dispextern.h (window_box, window_box_height, window_text_bottom_y) (window_box_width, window_box_left, window_box_left_offset) (window_box_right, window_box_right_offset): Undo previous change, by removing the "extern"s. * intervals.c (adjust_intervals_for_insertion) (adjust_intervals_for_deletion): Undo previous change, making these static again. (offset_intervals, temp_set_point_both, temp_set_point) (copy_intervals_to_string): No longer inline. * xdisp.c (window_text_bottom_y, window_box_width) (window_box_height, window_box_left_offset) (window_box_right_offset, window_box_left, window_box_right) (window_box): No longer inline. --- src/dispextern.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/dispextern.h') diff --git a/src/dispextern.h b/src/dispextern.h index fdc7f2f908d..5c60a5499da 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3006,14 +3006,14 @@ int resize_mini_window (struct window *, int); void set_vertical_scroll_bar (struct window *); #endif int try_window (Lisp_Object, struct text_pos, int); -extern void window_box (struct window *, int, int *, int *, int *, int *); -extern int window_box_height (struct window *); -extern int window_text_bottom_y (struct window *); -extern int window_box_width (struct window *, int); -extern int window_box_left (struct window *, int); -extern int window_box_left_offset (struct window *, int); -extern int window_box_right (struct window *, int); -extern int window_box_right_offset (struct window *, int); +void window_box (struct window *, int, int *, int *, int *, int *); +int window_box_height (struct window *); +int window_text_bottom_y (struct window *); +int window_box_width (struct window *, int); +int window_box_left (struct window *, int); +int window_box_left_offset (struct window *, int); +int window_box_right (struct window *, int); +int window_box_right_offset (struct window *, int); int estimate_mode_line_height (struct frame *, enum face_id); void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, NativeRectangle *, int); -- cgit v1.2.1 From 015137db608f0678112ae9a69a1a52889d56161d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 18 Nov 2011 14:21:42 +0200 Subject: Fix another crash due to incorrect hash value of glyph rows, bug #10035. src/dispnew.c (swap_glyph_pointers): Swap the used[] arrays and the hash values of the two rows. (copy_row_except_pointers): Preserve the used[] arrays and the hash values of the two rows. src/xdisp.c (row_hash): New function, body extracted from compute_line_metrics. (compute_line_metrics): Call row_hash, instead of computing the hash code inline. src/dispnew.c (verify_row_hash): Call row_hash for computing the hash code of a row, instead of duplicating code from xdisp.c. src/dispextern.h (row_hash): Add prototype. --- src/dispextern.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/dispextern.h') diff --git a/src/dispextern.h b/src/dispextern.h index 5c60a5499da..486aa4f7a40 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3126,6 +3126,9 @@ void compute_fringe_widths (struct frame *, int); void w32_init_fringe (struct redisplay_interface *); void w32_reset_fringes (void); #endif + +extern unsigned row_hash (struct glyph_row *); + /* Defined in image.c */ #ifdef HAVE_WINDOW_SYSTEM -- cgit v1.2.1 From 61ccba97a11dd945138a5459955456ebb19b9e74 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Nov 2011 10:29:29 -0800 Subject: Fix minor problems found by static checking. * dispextern.h, xdisp.c (row_hash): Declare extern only if XASSERTS. * dispnew.c (verify_row_hash): Now static. --- src/dispextern.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/dispextern.h') diff --git a/src/dispextern.h b/src/dispextern.h index 486aa4f7a40..48dd374f3c5 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3127,7 +3127,9 @@ void w32_init_fringe (struct redisplay_interface *); void w32_reset_fringes (void); #endif +#if XASSERTS extern unsigned row_hash (struct glyph_row *); +#endif /* Defined in image.c */ -- cgit v1.2.1