diff options
| author | Paul Eggert | 2011-07-06 14:56:44 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-06 14:56:44 -0700 |
| commit | 437dd18bf116330a43585f85aac12e6a8171b8a2 (patch) | |
| tree | 940d7fb2657b6aedaa007842c59b703ca9727e5e /src | |
| parent | 4906cd3d170f550150b28a22c2000dd0b4ff326f (diff) | |
| parent | 22b4128ef0160a0fab35a5d6dfc0f6a55c8bad93 (diff) | |
| download | emacs-437dd18bf116330a43585f85aac12e6a8171b8a2.tar.gz emacs-437dd18bf116330a43585f85aac12e6a8171b8a2.zip | |
Merge: Remove unportable assumption about struct layout (Bug#8884).
* buffer.c (clone_per_buffer_values): Don't assume that
sizeof (struct buffer) is a multiple of sizeof (Lisp_Object).
This isn't true in general, and it's particularly not true
if Emacs is configured with --with-wide-int.
* buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER):
New macros, used in the buffer.c change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/buffer.h | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index dc62da2035b..72a6f875f53 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-07-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Remove unportable assumption about struct layout (Bug#8884). | ||
| 4 | * buffer.c (clone_per_buffer_values): Don't assume that | ||
| 5 | sizeof (struct buffer) is a multiple of sizeof (Lisp_Object). | ||
| 6 | This isn't true in general, and it's particularly not true | ||
| 7 | if Emacs is configured with --with-wide-int. | ||
| 8 | * buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER): | ||
| 9 | New macros, used in the buffer.c change. | ||
| 10 | |||
| 1 | 2011-07-05 Jan Djärv <jan.h.d@swipnet.se> | 11 | 2011-07-05 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 12 | ||
| 3 | * xsettings.c: Use both GConf and GSettings if both are available. | 13 | * xsettings.c: Use both GConf and GSettings if both are available. |
diff --git a/src/buffer.c b/src/buffer.c index 2339416eb36..6c7c2ec0d86 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -471,8 +471,8 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) | |||
| 471 | 471 | ||
| 472 | /* buffer-local Lisp variables start at `undo_list', | 472 | /* buffer-local Lisp variables start at `undo_list', |
| 473 | tho only the ones from `name' on are GC'd normally. */ | 473 | tho only the ones from `name' on are GC'd normally. */ |
| 474 | for (offset = PER_BUFFER_VAR_OFFSET (undo_list); | 474 | for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); |
| 475 | offset < sizeof *to; | 475 | offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); |
| 476 | offset += sizeof (Lisp_Object)) | 476 | offset += sizeof (Lisp_Object)) |
| 477 | { | 477 | { |
| 478 | Lisp_Object obj; | 478 | Lisp_Object obj; |
diff --git a/src/buffer.h b/src/buffer.h index 4643e0d9d0e..06864dd5789 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -612,6 +612,7 @@ struct buffer | |||
| 612 | /* Everything from here down must be a Lisp_Object. */ | 612 | /* Everything from here down must be a Lisp_Object. */ |
| 613 | /* buffer-local Lisp variables start at `undo_list', | 613 | /* buffer-local Lisp variables start at `undo_list', |
| 614 | tho only the ones from `name' on are GC'd normally. */ | 614 | tho only the ones from `name' on are GC'd normally. */ |
| 615 | #define FIRST_FIELD_PER_BUFFER undo_list | ||
| 615 | 616 | ||
| 616 | /* Changes in the buffer are recorded here for undo. | 617 | /* Changes in the buffer are recorded here for undo. |
| 617 | t means don't record anything. | 618 | t means don't record anything. |
| @@ -846,6 +847,9 @@ struct buffer | |||
| 846 | t means to use hollow box cursor. | 847 | t means to use hollow box cursor. |
| 847 | See `cursor-type' for other values. */ | 848 | See `cursor-type' for other values. */ |
| 848 | Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows); | 849 | Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows); |
| 850 | |||
| 851 | /* This must be the last field in the above list. */ | ||
| 852 | #define LAST_FIELD_PER_BUFFER cursor_in_non_selected_windows | ||
| 849 | }; | 853 | }; |
| 850 | 854 | ||
| 851 | 855 | ||