aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
authorPaul Eggert2019-04-08 12:59:22 -0700
committerPaul Eggert2019-04-08 13:01:21 -0700
commita038df77de7b1aa2d73a6478493b8838b59e4982 (patch)
treefbaa0087bab52a815dfd249d189301e53de0d345 /src/thread.c
parent31e9087cdcd0b78b2247c3d8532290881abfbb08 (diff)
downloademacs-a038df77de7b1aa2d73a6478493b8838b59e4982.tar.gz
emacs-a038df77de7b1aa2d73a6478493b8838b59e4982.zip
Allow gap before first non-Lisp pseudovec member
Problem reported by Keith David Bershatsky in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00259.html Solution suggested by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00282.html * src/buffer.h (BUFFER_LISP_SIZE): Simplify by using PSEUDOVECSIZE. (BUFFER_REST_SIZE): Simplify by using VECSIZE and BUFFER_LISP_SIZE. * src/lisp.h (PSEUDOVECSIZE): Base it on the last Lisp field, not the first non-Lisp field. All callers changed. Callers without Lisp fields changed to use ALLOCATE_PLAIN_PSEUDOVECTOR. (ALLOCATE_PLAIN_PSEUDOVECTOR): New macro.
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/thread.c b/src/thread.c
index e51d6144347..670680f2b0d 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -267,7 +267,7 @@ informational only. */)
267 if (!NILP (name)) 267 if (!NILP (name))
268 CHECK_STRING (name); 268 CHECK_STRING (name);
269 269
270 mutex = ALLOCATE_PSEUDOVECTOR (struct Lisp_Mutex, mutex, PVEC_MUTEX); 270 mutex = ALLOCATE_PSEUDOVECTOR (struct Lisp_Mutex, name, PVEC_MUTEX);
271 memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex), 271 memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex),
272 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex, 272 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex,
273 mutex)); 273 mutex));
@@ -386,7 +386,7 @@ informational only. */)
386 if (!NILP (name)) 386 if (!NILP (name))
387 CHECK_STRING (name); 387 CHECK_STRING (name);
388 388
389 condvar = ALLOCATE_PSEUDOVECTOR (struct Lisp_CondVar, cond, PVEC_CONDVAR); 389 condvar = ALLOCATE_PSEUDOVECTOR (struct Lisp_CondVar, name, PVEC_CONDVAR);
390 memset ((char *) condvar + offsetof (struct Lisp_CondVar, cond), 390 memset ((char *) condvar + offsetof (struct Lisp_CondVar, cond),
391 0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar, 391 0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar,
392 cond)); 392 cond));
@@ -805,7 +805,7 @@ If NAME is given, it must be a string; it names the new thread. */)
805 if (!NILP (name)) 805 if (!NILP (name))
806 CHECK_STRING (name); 806 CHECK_STRING (name);
807 807
808 new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, m_stack_bottom, 808 new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, event_object,
809 PVEC_THREAD); 809 PVEC_THREAD);
810 memset ((char *) new_thread + offset, 0, 810 memset ((char *) new_thread + offset, 0,
811 sizeof (struct thread_state) - offset); 811 sizeof (struct thread_state) - offset);
@@ -1064,7 +1064,7 @@ static void
1064init_main_thread (void) 1064init_main_thread (void)
1065{ 1065{
1066 main_thread.s.header.size 1066 main_thread.s.header.size
1067 = PSEUDOVECSIZE (struct thread_state, m_stack_bottom); 1067 = PSEUDOVECSIZE (struct thread_state, event_object);
1068 XSETPVECTYPE (&main_thread.s, PVEC_THREAD); 1068 XSETPVECTYPE (&main_thread.s, PVEC_THREAD);
1069 main_thread.s.m_last_thing_searched = Qnil; 1069 main_thread.s.m_last_thing_searched = Qnil;
1070 main_thread.s.m_saved_last_thing_searched = Qnil; 1070 main_thread.s.m_saved_last_thing_searched = Qnil;