]> git.eshelyaron.com Git - emacs.git/commitdiff
* buffer.c (init_buffer_once): Fix initialization of
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 4 Jul 2012 15:49:46 +0000 (19:49 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 4 Jul 2012 15:49:46 +0000 (19:49 +0400)
headers for buffer_defaults and buffer_local_symbols.
Reported by Juanma Barranquero <lekktu@gmail.com>.

src/ChangeLog
src/buffer.c

index 70f7fedf5adade057a5f44f8bf14f39e194cc8bf..deac87ffca218f5ee65617af43539ededd93d19b 100644 (file)
@@ -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.
index 1e68d7d6b74a18fa3ef7ec194473a8a8292f20d1..e1652e9e10549352594e931dabf3455951656ff8 100644 (file)
@@ -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.  */