Remove more assumptions re struct layout (Bug#8884).

This commit is contained in:
Paul Eggert 2011-07-06 15:22:32 -07:00
parent 437dd18bf1
commit 8a5c77bba5
3 changed files with 9 additions and 6 deletions

View file

@ -1,7 +1,9 @@
2011-07-06 Paul Eggert <eggert@cs.ucla.edu>
Remove unportable assumption about struct layout (Bug#8884).
* buffer.c (clone_per_buffer_values): Don't assume that
* alloc.c (mark_buffer):
* buffer.c (reset_buffer_local_variables, Fbuffer_local_variables)
(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.

View file

@ -5619,7 +5619,8 @@ mark_buffer (Lisp_Object buf)
/* buffer-local Lisp variables start at `undo_list',
tho only the ones from `name' on are GC'd normally. */
for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name);
(char *)ptr < (char *)buffer + sizeof (struct buffer);
ptr <= &PER_BUFFER_VALUE (buffer,
PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER));
ptr++)
mark_object (*ptr);

View file

@ -830,8 +830,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
/* buffer-local Lisp variables start at `undo_list',
tho only the ones from `name' on are GC'd normally. */
for (offset = PER_BUFFER_VAR_OFFSET (undo_list);
offset < sizeof *b;
for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
offset += sizeof (Lisp_Object))
{
int idx = PER_BUFFER_IDX (offset);
@ -1055,8 +1055,8 @@ No argument or nil as argument means use current buffer as BUFFER. */)
/* buffer-local Lisp variables start at `undo_list',
tho only the ones from `name' on are GC'd normally. */
for (offset = PER_BUFFER_VAR_OFFSET (undo_list);
offset < sizeof (struct buffer);
for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
/* sizeof EMACS_INT == sizeof Lisp_Object */
offset += (sizeof (EMACS_INT)))
{