Commit 8a5c77bb authored by Paul Eggert's avatar Paul Eggert

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

parent 437dd18b
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.
......
......@@ -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);
......
......@@ -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)))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment