diff options
| author | Paul Eggert | 2011-07-06 15:22:32 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-06 15:22:32 -0700 |
| commit | 8a5c77bba5e38c62605f0f053670a7955130fcc7 (patch) | |
| tree | 1e8151eafcd78b625cd097340d066d79ce5a25f2 /src | |
| parent | 437dd18bf116330a43585f85aac12e6a8171b8a2 (diff) | |
| download | emacs-8a5c77bba5e38c62605f0f053670a7955130fcc7.tar.gz emacs-8a5c77bba5e38c62605f0f053670a7955130fcc7.zip | |
Remove more assumptions re struct layout (Bug#8884).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/alloc.c | 3 | ||||
| -rw-r--r-- | src/buffer.c | 8 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 72a6f875f53..11ba7e00705 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | 2011-07-06 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-07-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Remove unportable assumption about struct layout (Bug#8884). | 3 | Remove unportable assumption about struct layout (Bug#8884). |
| 4 | * buffer.c (clone_per_buffer_values): Don't assume that | 4 | * alloc.c (mark_buffer): |
| 5 | * buffer.c (reset_buffer_local_variables, Fbuffer_local_variables) | ||
| 6 | (clone_per_buffer_values): Don't assume that | ||
| 5 | sizeof (struct buffer) is a multiple of sizeof (Lisp_Object). | 7 | sizeof (struct buffer) is a multiple of sizeof (Lisp_Object). |
| 6 | This isn't true in general, and it's particularly not true | 8 | This isn't true in general, and it's particularly not true |
| 7 | if Emacs is configured with --with-wide-int. | 9 | if Emacs is configured with --with-wide-int. |
diff --git a/src/alloc.c b/src/alloc.c index 43befd722bb..f679787e95c 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5619,7 +5619,8 @@ mark_buffer (Lisp_Object buf) | |||
| 5619 | /* buffer-local Lisp variables start at `undo_list', | 5619 | /* buffer-local Lisp variables start at `undo_list', |
| 5620 | tho only the ones from `name' on are GC'd normally. */ | 5620 | tho only the ones from `name' on are GC'd normally. */ |
| 5621 | for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name); | 5621 | for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name); |
| 5622 | (char *)ptr < (char *)buffer + sizeof (struct buffer); | 5622 | ptr <= &PER_BUFFER_VALUE (buffer, |
| 5623 | PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER)); | ||
| 5623 | ptr++) | 5624 | ptr++) |
| 5624 | mark_object (*ptr); | 5625 | mark_object (*ptr); |
| 5625 | 5626 | ||
diff --git a/src/buffer.c b/src/buffer.c index 6c7c2ec0d86..e2f34d629e9 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -830,8 +830,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) | |||
| 830 | 830 | ||
| 831 | /* buffer-local Lisp variables start at `undo_list', | 831 | /* buffer-local Lisp variables start at `undo_list', |
| 832 | tho only the ones from `name' on are GC'd normally. */ | 832 | tho only the ones from `name' on are GC'd normally. */ |
| 833 | for (offset = PER_BUFFER_VAR_OFFSET (undo_list); | 833 | for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); |
| 834 | offset < sizeof *b; | 834 | offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); |
| 835 | offset += sizeof (Lisp_Object)) | 835 | offset += sizeof (Lisp_Object)) |
| 836 | { | 836 | { |
| 837 | int idx = PER_BUFFER_IDX (offset); | 837 | int idx = PER_BUFFER_IDX (offset); |
| @@ -1055,8 +1055,8 @@ No argument or nil as argument means use current buffer as BUFFER. */) | |||
| 1055 | 1055 | ||
| 1056 | /* buffer-local Lisp variables start at `undo_list', | 1056 | /* buffer-local Lisp variables start at `undo_list', |
| 1057 | tho only the ones from `name' on are GC'd normally. */ | 1057 | tho only the ones from `name' on are GC'd normally. */ |
| 1058 | for (offset = PER_BUFFER_VAR_OFFSET (undo_list); | 1058 | for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); |
| 1059 | offset < sizeof (struct buffer); | 1059 | offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); |
| 1060 | /* sizeof EMACS_INT == sizeof Lisp_Object */ | 1060 | /* sizeof EMACS_INT == sizeof Lisp_Object */ |
| 1061 | offset += (sizeof (EMACS_INT))) | 1061 | offset += (sizeof (EMACS_INT))) |
| 1062 | { | 1062 | { |