summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-07-04 19:49:46 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-07-04 19:49:46 +0400
commit3884d954f32acb816332d7837fe813bc546f6268 (patch)
tree9d2b944ab9774d64db5251dab0b4b58632233680
parentb5771c0d82b0c1b376e53d8bb92ec4137901db67 (diff)
downloademacs-3884d954f32acb816332d7837fe813bc546f6268.tar.gz
* buffer.c (init_buffer_once): Fix initialization of
headers for buffer_defaults and buffer_local_symbols. Reported by Juanma Barranquero <lekktu@gmail.com>.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/buffer.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 70f7fedf5ad..deac87ffca2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-04 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * buffer.c (init_buffer_once): Fix initialization of
+ headers for buffer_defaults and buffer_local_symbols.
+ Reported by Juanma Barranquero <lekktu@gmail.com>.
+
2012-07-04 Stefan Monnier <monnier@iro.umontreal.ca>
Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE.
diff --git a/src/buffer.c b/src/buffer.c
index 1e68d7d6b74..e1652e9e105 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4870,6 +4870,12 @@ void
init_buffer_once (void)
{
int idx;
+ /* If you add, remove, or reorder Lisp_Objects in a struct buffer, make
+ sure that this is still correct. Otherwise, mark_vectorlike may not
+ trace all Lisp_Objects in buffer_defaults and buffer_local_symbols. */
+ const int pvecsize
+ = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header))
+ / sizeof (Lisp_Object);
memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
@@ -4886,9 +4892,9 @@ init_buffer_once (void)
buffer_local_symbols.text = &buffer_local_symbols.own_text;
BUF_INTERVALS (&buffer_defaults) = 0;
BUF_INTERVALS (&buffer_local_symbols) = 0;
- XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0);
+ XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
- XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0);
+ XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
/* Set up the default values of various buffer slots. */