diff options
| author | Paul Eggert | 2019-04-08 12:59:22 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-04-08 13:01:21 -0700 |
| commit | a038df77de7b1aa2d73a6478493b8838b59e4982 (patch) | |
| tree | fbaa0087bab52a815dfd249d189301e53de0d345 /src/buffer.h | |
| parent | 31e9087cdcd0b78b2247c3d8532290881abfbb08 (diff) | |
| download | emacs-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/buffer.h')
| -rw-r--r-- | src/buffer.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/buffer.h b/src/buffer.h index 63b162161c6..f42c3e97b97 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -741,8 +741,8 @@ struct buffer | |||
| 741 | See `cursor-type' for other values. */ | 741 | See `cursor-type' for other values. */ |
| 742 | Lisp_Object cursor_in_non_selected_windows_; | 742 | Lisp_Object cursor_in_non_selected_windows_; |
| 743 | 743 | ||
| 744 | /* No more Lisp_Object beyond this point. Except undo_list, | 744 | /* No more Lisp_Object beyond cursor_in_non_selected_windows_. |
| 745 | which is handled specially in Fgarbage_collect. */ | 745 | Except undo_list, which is handled specially in Fgarbage_collect. */ |
| 746 | 746 | ||
| 747 | /* This structure holds the coordinates of the buffer contents | 747 | /* This structure holds the coordinates of the buffer contents |
| 748 | in ordinary buffers. In indirect buffers, this is not used. */ | 748 | in ordinary buffers. In indirect buffers, this is not used. */ |
| @@ -1019,14 +1019,12 @@ bset_width_table (struct buffer *b, Lisp_Object val) | |||
| 1019 | structure, make sure that this is still correct. */ | 1019 | structure, make sure that this is still correct. */ |
| 1020 | 1020 | ||
| 1021 | #define BUFFER_LISP_SIZE \ | 1021 | #define BUFFER_LISP_SIZE \ |
| 1022 | ((offsetof (struct buffer, own_text) - header_size) / word_size) | 1022 | PSEUDOVECSIZE (struct buffer, cursor_in_non_selected_windows_) |
| 1023 | 1023 | ||
| 1024 | /* Size of the struct buffer part beyond leading Lisp_Objects, in word_size | 1024 | /* Allocated size of the struct buffer part beyond leading |
| 1025 | units. Rounding is needed for --with-wide-int configuration. */ | 1025 | Lisp_Objects, in word_size units. */ |
| 1026 | 1026 | ||
| 1027 | #define BUFFER_REST_SIZE \ | 1027 | #define BUFFER_REST_SIZE (VECSIZE (struct buffer) - BUFFER_LISP_SIZE) |
| 1028 | ((((sizeof (struct buffer) - offsetof (struct buffer, own_text)) \ | ||
| 1029 | + (word_size - 1)) & ~(word_size - 1)) / word_size) | ||
| 1030 | 1028 | ||
| 1031 | /* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE | 1029 | /* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE |
| 1032 | is required for GC, but BUFFER_REST_SIZE is set up just to be consistent | 1030 | is required for GC, but BUFFER_REST_SIZE is set up just to be consistent |