aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorPaul Eggert2019-04-08 12:59:22 -0700
committerPaul Eggert2019-04-08 13:01:21 -0700
commita038df77de7b1aa2d73a6478493b8838b59e4982 (patch)
treefbaa0087bab52a815dfd249d189301e53de0d345 /src/window.c
parent31e9087cdcd0b78b2247c3d8532290881abfbb08 (diff)
downloademacs-a038df77de7b1aa2d73a6478493b8838b59e4982.tar.gz
emacs-a038df77de7b1aa2d73a6478493b8838b59e4982.zip
Allow gap before first non-Lisp pseudovec member
Problem reported by Keith David Bershatsky in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00259.html Solution suggested by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00282.html * src/buffer.h (BUFFER_LISP_SIZE): Simplify by using PSEUDOVECSIZE. (BUFFER_REST_SIZE): Simplify by using VECSIZE and BUFFER_LISP_SIZE. * src/lisp.h (PSEUDOVECSIZE): Base it on the last Lisp field, not the first non-Lisp field. All callers changed. Callers without Lisp fields changed to use ALLOCATE_PLAIN_PSEUDOVECTOR. (ALLOCATE_PLAIN_PSEUDOVECTOR): New macro.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/window.c b/src/window.c
index be338c2af61..f911c0c7d44 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4170,8 +4170,8 @@ temp_output_buffer_show (register Lisp_Object buf)
4170static struct window * 4170static struct window *
4171allocate_window (void) 4171allocate_window (void)
4172{ 4172{
4173 return ALLOCATE_ZEROED_PSEUDOVECTOR 4173 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct window, mode_line_help_echo,
4174 (struct window, current_matrix, PVEC_WINDOW); 4174 PVEC_WINDOW);
4175} 4175}
4176 4176
4177/* Make new window, have it replace WINDOW in window-tree, and make 4177/* Make new window, have it replace WINDOW in window-tree, and make
@@ -6710,7 +6710,8 @@ struct save_window_data
6710 Lisp_Object saved_windows; 6710 Lisp_Object saved_windows;
6711 6711
6712 /* All fields above are traced by the GC. 6712 /* All fields above are traced by the GC.
6713 From `frame-cols' down, the fields are ignored by the GC. */ 6713 After saved_windows, the fields are ignored by the GC. */
6714
6714 /* We should be able to do without the following two. */ 6715 /* We should be able to do without the following two. */
6715 int frame_cols, frame_lines; 6716 int frame_cols, frame_lines;
6716 /* These two should get eventually replaced by their pixel 6717 /* These two should get eventually replaced by their pixel
@@ -7383,15 +7384,11 @@ redirection (see `redirect-frame-focus'). The variable
7383saved by this function. */) 7384saved by this function. */)
7384 (Lisp_Object frame) 7385 (Lisp_Object frame)
7385{ 7386{
7386 Lisp_Object tem;
7387 ptrdiff_t i, n_windows;
7388 struct save_window_data *data;
7389 struct frame *f = decode_live_frame (frame); 7387 struct frame *f = decode_live_frame (frame);
7390 7388 ptrdiff_t n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
7391 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); 7389 struct save_window_data *data
7392 data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, 7390 = ALLOCATE_PSEUDOVECTOR (struct save_window_data, saved_windows,
7393 PVEC_WINDOW_CONFIGURATION); 7391 PVEC_WINDOW_CONFIGURATION);
7394
7395 data->frame_cols = FRAME_COLS (f); 7392 data->frame_cols = FRAME_COLS (f);
7396 data->frame_lines = FRAME_LINES (f); 7393 data->frame_lines = FRAME_LINES (f);
7397 data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); 7394 data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
@@ -7407,9 +7404,9 @@ saved by this function. */)
7407 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; 7404 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
7408 data->root_window = FRAME_ROOT_WINDOW (f); 7405 data->root_window = FRAME_ROOT_WINDOW (f);
7409 data->focus_frame = FRAME_FOCUS_FRAME (f); 7406 data->focus_frame = FRAME_FOCUS_FRAME (f);
7410 tem = make_uninit_vector (n_windows); 7407 Lisp_Object tem = make_uninit_vector (n_windows);
7411 data->saved_windows = tem; 7408 data->saved_windows = tem;
7412 for (i = 0; i < n_windows; i++) 7409 for (ptrdiff_t i = 0; i < n_windows; i++)
7413 ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window))); 7410 ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
7414 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); 7411 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
7415 XSETWINDOW_CONFIGURATION (tem, data); 7412 XSETWINDOW_CONFIGURATION (tem, data);