aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2011-05-09 05:59:23 -0400
committerEli Zaretskii2011-05-09 05:59:23 -0400
commit14fe7b530dc927a88169a841afc0cd806593dea8 (patch)
tree510192ce4c22c74ffec5b97327ea5e4a03a5a66c /src
parent6eea50c73be34e865dabf14cbd2d0e7c4f64e6a0 (diff)
downloademacs-14fe7b530dc927a88169a841afc0cd806593dea8.tar.gz
emacs-14fe7b530dc927a88169a841afc0cd806593dea8.zip
Backport revisions 2011-04-24T05:30:24Z!eggert@cs.ucla.edu..2011-04-25T19:40:22Z!eggert@cs.ucla.edu (inclusive) from trunk (bug#8623)
The next log entry shows the actual changes by Paul Eggert. Fix a problem with aliasing and vector headers. GCC 4.6.0 optimizes based on type-based alias analysis. For example, if b is of type struct buffer * and v of type struct Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size != &v->size, and therefore "v->size = 1; b->size = 2; return v->size;" must therefore return 1. This assumption is incorrect for Emacs, since it type-puns struct Lisp_Vector * with many other types. To fix this problem, this patch adds a new type struct vector_header that documents the constraints on layout of vectors and pseudovectors, and helps optimizing compilers not get fooled by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons. src/lisp.h (XVECTOR_SIZE): New convenience macro. All previous uses of XVECTOR (foo)->size replaced to use this macro, to avoid the hassle of writing XVECTOR (foo)->header.size. src/lisp.h: Say "vectorlike header" rather than "vector header. (struct vectorlike_header): Rename from struct vector_header. (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE. All uses changed. (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR. (XSETTYPED_PVECTYPE): New macro, specifying the name of the size member. (XSETPVECTYPE): Rewrite in terms of new macro. (XSETPVECTYPESIZE): New macro, specifying both type and size. This is a bit clearer, and further avoids the possibility of undesirable aliasing. (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size. (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XVECTOR_HEADER_SIZE. (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE, since Lisp_Subr is a special case (no "next" field). (ASIZE): Rewrite in terms of XVECTOR_SIZE. (struct vector_header): New type. (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the object, to help avoid aliasing. (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP. (SUBRP): Likewise, since Lisp_Subr is a special case. src/lisp.h (struct Lisp_Vector, struct Lisp_Char_Table): (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector): (struct Lisp_Hash_Table): Combine first two members into a single struct vector_header member. All uses of "size" and "next" members changed to be "header.size" and "header.next". src/buffer.h (struct buffer): Likewise. src/font.h (struct font_spec, struct font_entity, struct font): Likewise. src/frame.h (struct frame): Likewise. src/process.h (struct Lisp_Process): Likewise. src/termhooks.h (struct terminal): Likewise. src/window.c (struct save_window_data, struct saved_window): Likewise. src/window.h (struct window): Likewise. src/alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector): Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems. src/buffer.c (init_buffer_once): Likewise. src/lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a special case. src/process.c (Fformat_network_address): Use local var for size, for brevity. src/fns.c (vector): Remove; this old hack is no longer needed. src/bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog68
-rw-r--r--src/alloc.c62
-rw-r--r--src/buffer.c18
-rw-r--r--src/buffer.h7
-rw-r--r--src/bytecode.c5
-rw-r--r--src/callint.c2
-rw-r--r--src/ccl.c2
-rw-r--r--src/character.c4
-rw-r--r--src/chartab.c2
-rw-r--r--src/coding.c2
-rw-r--r--src/composite.c6
-rw-r--r--src/data.c8
-rw-r--r--src/dispnew.c10
-rw-r--r--src/disptab.h2
-rw-r--r--src/doc.c2
-rw-r--r--src/fns.c15
-rw-r--r--src/font.c2
-rw-r--r--src/font.h9
-rw-r--r--src/frame.h3
-rw-r--r--src/fringe.c2
-rw-r--r--src/image.c4
-rw-r--r--src/indent.c12
-rw-r--r--src/keyboard.c42
-rw-r--r--src/keymap.c10
-rw-r--r--src/lisp.h73
-rw-r--r--src/lread.c22
-rw-r--r--src/minibuf.c6
-rw-r--r--src/print.c12
-rw-r--r--src/process.c15
-rw-r--r--src/process.h6
-rw-r--r--src/syntax.c4
-rw-r--r--src/termhooks.h6
-rw-r--r--src/w32font.c2
-rw-r--r--src/w32menu.c8
-rw-r--r--src/window.c14
-rw-r--r--src/window.h7
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xmenu.c16
-rw-r--r--src/xselect.c16
40 files changed, 299 insertions, 219 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 42d9185e0dd..2a051a9e27b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,71 @@
12011-05-09 Eli Zaretskii <eliz@gnu.org>
2
3 Backport revisions 103939.1.41..103939.1.44 (inclusive) from trunk.
4 (bug#8623)
5 The next log entry shows the actual changes by Paul Eggert.
6
72011-05-08 Paul Eggert <eggert@cs.ucla.edu>
8
9 Fix a problem with aliasing and vector headers.
10 GCC 4.6.0 optimizes based on type-based alias analysis. For
11 example, if b is of type struct buffer * and v of type struct
12 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
13 != &v->size, and therefore "v->size = 1; b->size = 2; return
14 v->size;" must therefore return 1. This assumption is incorrect
15 for Emacs, since it type-puns struct Lisp_Vector * with many other
16 types. To fix this problem, this patch adds a new type struct
17 vector_header that documents the constraints on layout of vectors
18 and pseudovectors, and helps optimizing compilers not get fooled
19 by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE
20 XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
21 * lisp.h (XVECTOR_SIZE): New convenience macro. All previous uses of
22 XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
23 of writing XVECTOR (foo)->header.size.
24 * lisp.h: Say "vectorlike header" rather than "vector header.
25 (struct vectorlike_header): Rename from struct vector_header.
26 (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
27 All uses changed.
28 (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
29 (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
30 member.
31 (XSETPVECTYPE): Rewrite in terms of new macro.
32 (XSETPVECTYPESIZE): New macro, specifying both type and size.
33 This is a bit clearer, and further avoids the possibility of
34 undesirable aliasing.
35 (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
36 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
37 and XVECTOR_HEADER_SIZE.
38 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
39 since Lisp_Subr is a special case (no "next" field).
40 (ASIZE): Rewrite in terms of XVECTOR_SIZE.
41 (struct vector_header): New type.
42 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
43 object, to help avoid aliasing.
44 (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
45 (SUBRP): Likewise, since Lisp_Subr is a special case.
46
47 * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
48 (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
49 (struct Lisp_Hash_Table): Combine first two members into a single
50 struct vector_header member. All uses of "size" and "next" members
51 changed to be "header.size" and "header.next".
52 * buffer.h (struct buffer): Likewise.
53 * font.h (struct font_spec, struct font_entity, struct font): Likewise.
54 * frame.h (struct frame): Likewise.
55 * process.h (struct Lisp_Process): Likewise.
56 * termhooks.h (struct terminal): Likewise.
57 * window.c (struct save_window_data, struct saved_window): Likewise.
58 * window.h (struct window): Likewise.
59 * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
60 Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
61 * buffer.c (init_buffer_once): Likewise.
62 * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
63 special case.
64 * process.c (Fformat_network_address): Use local var for size,
65 for brevity.
66 * fns.c (vector): Remove; this old hack is no longer needed.
67 * bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
68
12011-04-29 Eli Zaretskii <eliz@gnu.org> 692011-04-29 Eli Zaretskii <eliz@gnu.org>
2 70
3 * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]: 71 * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:
diff --git a/src/alloc.c b/src/alloc.c
index ad11e215da7..77b870f4754 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -163,9 +163,9 @@ static __malloc_size_t bytes_used_when_reconsidered;
163#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG) 163#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG)
164#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0) 164#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0)
165 165
166#define VECTOR_MARK(V) ((V)->size |= ARRAY_MARK_FLAG) 166#define VECTOR_MARK(V) ((V)->header.size |= ARRAY_MARK_FLAG)
167#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) 167#define VECTOR_UNMARK(V) ((V)->header.size &= ~ARRAY_MARK_FLAG)
168#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0) 168#define VECTOR_MARKED_P(V) (((V)->header.size & ARRAY_MARK_FLAG) != 0)
169 169
170/* Value is the number of bytes/chars of S, a pointer to a struct 170/* Value is the number of bytes/chars of S, a pointer to a struct
171 Lisp_String. This must be used instead of STRING_BYTES (S) or 171 Lisp_String. This must be used instead of STRING_BYTES (S) or
@@ -1151,8 +1151,9 @@ allocate_buffer ()
1151 struct buffer *b 1151 struct buffer *b
1152 = (struct buffer *) lisp_malloc (sizeof (struct buffer), 1152 = (struct buffer *) lisp_malloc (sizeof (struct buffer),
1153 MEM_TYPE_BUFFER); 1153 MEM_TYPE_BUFFER);
1154 b->size = sizeof (struct buffer) / sizeof (EMACS_INT); 1154 XSETPVECTYPESIZE (b, PVEC_BUFFER,
1155 XSETPVECTYPE (b, PVEC_BUFFER); 1155 ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1)
1156 / sizeof (EMACS_INT)));
1156 return b; 1157 return b;
1157} 1158}
1158 1159
@@ -2341,10 +2342,8 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
2341 slot `size' of the struct Lisp_Bool_Vector. */ 2342 slot `size' of the struct Lisp_Bool_Vector. */
2342 val = Fmake_vector (make_number (length_in_elts + 1), Qnil); 2343 val = Fmake_vector (make_number (length_in_elts + 1), Qnil);
2343 2344
2344 /* Get rid of any bits that would cause confusion. */ 2345 /* No Lisp_Object to trace in there. */
2345 XVECTOR (val)->size = 0; /* No Lisp_Object to trace in there. */ 2346 XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0);
2346 /* Use XVECTOR (val) rather than `p' because p->size is not TRT. */
2347 XSETPVECTYPE (XVECTOR (val), PVEC_BOOL_VECTOR);
2348 2347
2349 p = XBOOL_VECTOR (val); 2348 p = XBOOL_VECTOR (val);
2350 p->size = XFASTINT (length); 2349 p->size = XFASTINT (length);
@@ -2943,7 +2942,7 @@ allocate_vectorlike (len)
2943 consing_since_gc += nbytes; 2942 consing_since_gc += nbytes;
2944 vector_cells_consed += len; 2943 vector_cells_consed += len;
2945 2944
2946 p->next = all_vectors; 2945 p->header.next.vector = all_vectors;
2947 all_vectors = p; 2946 all_vectors = p;
2948 2947
2949 MALLOC_UNBLOCK_INPUT; 2948 MALLOC_UNBLOCK_INPUT;
@@ -2960,7 +2959,7 @@ allocate_vector (nslots)
2960 EMACS_INT nslots; 2959 EMACS_INT nslots;
2961{ 2960{
2962 struct Lisp_Vector *v = allocate_vectorlike (nslots); 2961 struct Lisp_Vector *v = allocate_vectorlike (nslots);
2963 v->size = nslots; 2962 v->header.size = nslots;
2964 return v; 2963 return v;
2965} 2964}
2966 2965
@@ -2976,11 +2975,10 @@ allocate_pseudovector (memlen, lisplen, tag)
2976 EMACS_INT i; 2975 EMACS_INT i;
2977 2976
2978 /* Only the first lisplen slots will be traced normally by the GC. */ 2977 /* Only the first lisplen slots will be traced normally by the GC. */
2979 v->size = lisplen;
2980 for (i = 0; i < lisplen; ++i) 2978 for (i = 0; i < lisplen; ++i)
2981 v->contents[i] = Qnil; 2979 v->contents[i] = Qnil;
2982 2980
2983 XSETPVECTYPE (v, tag); /* Add the appropriate tag. */ 2981 XSETPVECTYPESIZE (v, tag, lisplen);
2984 return v; 2982 return v;
2985} 2983}
2986 2984
@@ -4884,7 +4882,7 @@ make_pure_vector (len)
4884 4882
4885 p = (struct Lisp_Vector *) pure_alloc (size, Lisp_Vectorlike); 4883 p = (struct Lisp_Vector *) pure_alloc (size, Lisp_Vectorlike);
4886 XSETVECTOR (new, p); 4884 XSETVECTOR (new, p);
4887 XVECTOR (new)->size = len; 4885 XVECTOR (new)->header.size = len;
4888 return new; 4886 return new;
4889} 4887}
4890 4888
@@ -4916,7 +4914,7 @@ Does not copy symbols. Copies strings without text properties. */)
4916 register int i; 4914 register int i;
4917 EMACS_INT size; 4915 EMACS_INT size;
4918 4916
4919 size = XVECTOR (obj)->size; 4917 size = XVECTOR_SIZE (obj);
4920 if (size & PSEUDOVECTOR_FLAG) 4918 if (size & PSEUDOVECTOR_FLAG)
4921 size &= PSEUDOVECTOR_SIZE_MASK; 4919 size &= PSEUDOVECTOR_SIZE_MASK;
4922 vec = XVECTOR (make_pure_vector (size)); 4920 vec = XVECTOR (make_pure_vector (size));
@@ -5038,7 +5036,7 @@ returns nil, because real GC can't be done. */)
5038 } 5036 }
5039 } 5037 }
5040 5038
5041 nextb = nextb->next; 5039 nextb = nextb->header.next.buffer;
5042 } 5040 }
5043 } 5041 }
5044 5042
@@ -5184,7 +5182,7 @@ returns nil, because real GC can't be done. */)
5184 undo_list any more, we can finally mark the list. */ 5182 undo_list any more, we can finally mark the list. */
5185 mark_object (nextb->undo_list); 5183 mark_object (nextb->undo_list);
5186 5184
5187 nextb = nextb->next; 5185 nextb = nextb->header.next.buffer;
5188 } 5186 }
5189 } 5187 }
5190 5188
@@ -5361,7 +5359,7 @@ static void
5361mark_vectorlike (ptr) 5359mark_vectorlike (ptr)
5362 struct Lisp_Vector *ptr; 5360 struct Lisp_Vector *ptr;
5363{ 5361{
5364 register EMACS_INT size = ptr->size; 5362 register EMACS_UINT size = ptr->header.size;
5365 register int i; 5363 register int i;
5366 5364
5367 eassert (!VECTOR_MARKED_P (ptr)); 5365 eassert (!VECTOR_MARKED_P (ptr));
@@ -5385,7 +5383,7 @@ static void
5385mark_char_table (ptr) 5383mark_char_table (ptr)
5386 struct Lisp_Vector *ptr; 5384 struct Lisp_Vector *ptr;
5387{ 5385{
5388 register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; 5386 register EMACS_UINT size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
5389 register int i; 5387 register int i;
5390 5388
5391 eassert (!VECTOR_MARKED_P (ptr)); 5389 eassert (!VECTOR_MARKED_P (ptr));
@@ -5500,7 +5498,7 @@ mark_object (arg)
5500 if (po != &buffer_defaults && po != &buffer_local_symbols) 5498 if (po != &buffer_defaults && po != &buffer_local_symbols)
5501 { 5499 {
5502 struct buffer *b; 5500 struct buffer *b;
5503 for (b = all_buffers; b && b != po; b = b->next) 5501 for (b = all_buffers; b && b != po; b = b->header.next.buffer)
5504 ; 5502 ;
5505 if (b == NULL) 5503 if (b == NULL)
5506 abort (); 5504 abort ();
@@ -5516,7 +5514,7 @@ mark_object (arg)
5516 recursion there. */ 5514 recursion there. */
5517 { 5515 {
5518 register struct Lisp_Vector *ptr = XVECTOR (obj); 5516 register struct Lisp_Vector *ptr = XVECTOR (obj);
5519 register EMACS_INT size = ptr->size; 5517 register EMACS_UINT size = ptr->header.size;
5520 register int i; 5518 register int i;
5521 5519
5522 CHECK_LIVE (live_vector_p); 5520 CHECK_LIVE (live_vector_p);
@@ -6150,10 +6148,10 @@ gc_sweep ()
6150 if (!VECTOR_MARKED_P (buffer)) 6148 if (!VECTOR_MARKED_P (buffer))
6151 { 6149 {
6152 if (prev) 6150 if (prev)
6153 prev->next = buffer->next; 6151 prev->header.next = buffer->header.next;
6154 else 6152 else
6155 all_buffers = buffer->next; 6153 all_buffers = buffer->header.next.buffer;
6156 next = buffer->next; 6154 next = buffer->header.next.buffer;
6157 lisp_free (buffer); 6155 lisp_free (buffer);
6158 buffer = next; 6156 buffer = next;
6159 } 6157 }
@@ -6161,7 +6159,7 @@ gc_sweep ()
6161 { 6159 {
6162 VECTOR_UNMARK (buffer); 6160 VECTOR_UNMARK (buffer);
6163 UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer)); 6161 UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer));
6164 prev = buffer, buffer = buffer->next; 6162 prev = buffer, buffer = buffer->header.next.buffer;
6165 } 6163 }
6166 } 6164 }
6167 6165
@@ -6174,10 +6172,10 @@ gc_sweep ()
6174 if (!VECTOR_MARKED_P (vector)) 6172 if (!VECTOR_MARKED_P (vector))
6175 { 6173 {
6176 if (prev) 6174 if (prev)
6177 prev->next = vector->next; 6175 prev->header.next = vector->header.next;
6178 else 6176 else
6179 all_vectors = vector->next; 6177 all_vectors = vector->header.next.vector;
6180 next = vector->next; 6178 next = vector->header.next.vector;
6181 lisp_free (vector); 6179 lisp_free (vector);
6182 n_vectors--; 6180 n_vectors--;
6183 vector = next; 6181 vector = next;
@@ -6186,11 +6184,11 @@ gc_sweep ()
6186 else 6184 else
6187 { 6185 {
6188 VECTOR_UNMARK (vector); 6186 VECTOR_UNMARK (vector);
6189 if (vector->size & PSEUDOVECTOR_FLAG) 6187 if (vector->header.size & PSEUDOVECTOR_FLAG)
6190 total_vector_size += (PSEUDOVECTOR_SIZE_MASK & vector->size); 6188 total_vector_size += PSEUDOVECTOR_SIZE_MASK & vector->header.size;
6191 else 6189 else
6192 total_vector_size += vector->size; 6190 total_vector_size += vector->header.size;
6193 prev = vector, vector = vector->next; 6191 prev = vector, vector = vector->header.next.vector;
6194 } 6192 }
6195 } 6193 }
6196 6194
diff --git a/src/buffer.c b/src/buffer.c
index 076495cfc64..70d7d00edfe 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -53,7 +53,7 @@ extern int errno;
53struct buffer *current_buffer; /* the current buffer */ 53struct buffer *current_buffer; /* the current buffer */
54 54
55/* First buffer in chain of all buffers (in reverse order of creation). 55/* First buffer in chain of all buffers (in reverse order of creation).
56 Threaded through ->next. */ 56 Threaded through ->header.next.buffer. */
57 57
58struct buffer *all_buffers; 58struct buffer *all_buffers;
59 59
@@ -400,7 +400,7 @@ even if it is dead. The return value is never nil. */)
400 b->prevent_redisplay_optimizations_p = 1; 400 b->prevent_redisplay_optimizations_p = 1;
401 401
402 /* Put this on the chain of all buffers including killed ones. */ 402 /* Put this on the chain of all buffers including killed ones. */
403 b->next = all_buffers; 403 b->header.next.buffer = all_buffers;
404 all_buffers = b; 404 all_buffers = b;
405 405
406 /* An ordinary buffer normally doesn't need markers 406 /* An ordinary buffer normally doesn't need markers
@@ -633,7 +633,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
633 b->width_table = Qnil; 633 b->width_table = Qnil;
634 634
635 /* Put this on the chain of all buffers including killed ones. */ 635 /* Put this on the chain of all buffers including killed ones. */
636 b->next = all_buffers; 636 b->header.next.buffer = all_buffers;
637 all_buffers = b; 637 all_buffers = b;
638 638
639 name = Fcopy_sequence (name); 639 name = Fcopy_sequence (name);
@@ -1544,7 +1544,7 @@ with SIGHUP. */)
1544 1544
1545 GCPRO1 (buffer); 1545 GCPRO1 (buffer);
1546 1546
1547 for (other = all_buffers; other; other = other->next) 1547 for (other = all_buffers; other; other = other->header.next.buffer)
1548 /* all_buffers contains dead buffers too; 1548 /* all_buffers contains dead buffers too;
1549 don't re-kill them. */ 1549 don't re-kill them. */
1550 if (other->base_buffer == b && !NILP (other->name)) 1550 if (other->base_buffer == b && !NILP (other->name))
@@ -2214,7 +2214,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2214 2214
2215 { /* This is probably harder to make work. */ 2215 { /* This is probably harder to make work. */
2216 struct buffer *other; 2216 struct buffer *other;
2217 for (other = all_buffers; other; other = other->next) 2217 for (other = all_buffers; other; other = other->header.next.buffer)
2218 if (other->base_buffer == other_buffer 2218 if (other->base_buffer == other_buffer
2219 || other->base_buffer == current_buffer) 2219 || other->base_buffer == current_buffer)
2220 error ("One of the buffers to swap has indirect buffers"); 2220 error ("One of the buffers to swap has indirect buffers");
@@ -2585,7 +2585,7 @@ current buffer is cleared. */)
2585 2585
2586 /* Copy this buffer's new multibyte status 2586 /* Copy this buffer's new multibyte status
2587 into all of its indirect buffers. */ 2587 into all of its indirect buffers. */
2588 for (other = all_buffers; other; other = other->next) 2588 for (other = all_buffers; other; other = other->header.next.buffer)
2589 if (other->base_buffer == current_buffer && !NILP (other->name)) 2589 if (other->base_buffer == current_buffer && !NILP (other->name))
2590 { 2590 {
2591 other->enable_multibyte_characters 2591 other->enable_multibyte_characters
@@ -4346,7 +4346,7 @@ static void
4346add_overlay_mod_hooklist (functionlist, overlay) 4346add_overlay_mod_hooklist (functionlist, overlay)
4347 Lisp_Object functionlist, overlay; 4347 Lisp_Object functionlist, overlay;
4348{ 4348{
4349 int oldsize = XVECTOR (last_overlay_modification_hooks)->size; 4349 int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks);
4350 4350
4351 if (last_overlay_modification_hooks_used == oldsize) 4351 if (last_overlay_modification_hooks_used == oldsize)
4352 last_overlay_modification_hooks = larger_vector 4352 last_overlay_modification_hooks = larger_vector
@@ -5150,9 +5150,9 @@ init_buffer_once ()
5150 buffer_local_symbols.text = &buffer_local_symbols.own_text; 5150 buffer_local_symbols.text = &buffer_local_symbols.own_text;
5151 BUF_INTERVALS (&buffer_defaults) = 0; 5151 BUF_INTERVALS (&buffer_defaults) = 0;
5152 BUF_INTERVALS (&buffer_local_symbols) = 0; 5152 BUF_INTERVALS (&buffer_local_symbols) = 0;
5153 XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER); 5153 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0);
5154 XSETBUFFER (Vbuffer_defaults, &buffer_defaults); 5154 XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
5155 XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER); 5155 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0);
5156 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); 5156 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
5157 5157
5158 /* Set up the default values of various buffer slots. */ 5158 /* Set up the default values of various buffer slots. */
diff --git a/src/buffer.h b/src/buffer.h
index 56d0422b7e3..a9240546427 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -487,14 +487,13 @@ struct buffer
487 487
488 Check out mark_buffer (alloc.c) to see why. */ 488 Check out mark_buffer (alloc.c) to see why. */
489 489
490 EMACS_UINT size; 490 /* HEADER.NEXT is the next buffer, in chain of all buffers,
491 491 including killed buffers.
492 /* Next buffer, in chain of all buffers including killed buffers.
493 This chain is used only for garbage collection, in order to 492 This chain is used only for garbage collection, in order to
494 collect killed buffers properly. 493 collect killed buffers properly.
495 Note that vectors and most pseudovectors are all on one chain, 494 Note that vectors and most pseudovectors are all on one chain,
496 but buffers are on a separate chain of their own. */ 495 but buffers are on a separate chain of their own. */
497 struct buffer *next; 496 struct vectorlike_header header;
498 497
499 /* This structure holds the coordinates of the buffer contents 498 /* This structure holds the coordinates of the buffer contents
500 in ordinary buffers. In indirect buffers, this is not used. */ 499 in ordinary buffers. In indirect buffers, this is not used. */
diff --git a/src/bytecode.c b/src/bytecode.c
index db80f5b1a9c..fd119c58e19 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -415,7 +415,7 @@ If the third argument is incorrect, Emacs may crash. */)
415 /* Lisp_Object v1, v2; */ 415 /* Lisp_Object v1, v2; */
416 Lisp_Object *vectorp; 416 Lisp_Object *vectorp;
417#ifdef BYTE_CODE_SAFE 417#ifdef BYTE_CODE_SAFE
418 int const_length = XVECTOR (vector)->size; 418 int const_length;
419 Lisp_Object *stacke; 419 Lisp_Object *stacke;
420#endif 420#endif
421 int bytestr_length; 421 int bytestr_length;
@@ -437,6 +437,9 @@ If the third argument is incorrect, Emacs may crash. */)
437 CHECK_VECTOR (vector); 437 CHECK_VECTOR (vector);
438 CHECK_NUMBER (maxdepth); 438 CHECK_NUMBER (maxdepth);
439 439
440#ifdef BYTE_CODE_SAFE
441 const_length = XVECTOR_SIZE (vector);
442#endif
440 if (STRING_MULTIBYTE (bytestr)) 443 if (STRING_MULTIBYTE (bytestr))
441 /* BYTESTR must have been produced by Emacs 20.2 or the earlier 444 /* BYTESTR must have been produced by Emacs 20.2 or the earlier
442 because they produced a raw 8-bit string for byte-code and now 445 because they produced a raw 8-bit string for byte-code and now
diff --git a/src/callint.c b/src/callint.c
index 8fd04bb00de..f4bdf40dfa3 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -313,7 +313,7 @@ invoke it. If KEYS is omitted or nil, the return value of
313 else 313 else
314 { 314 {
315 CHECK_VECTOR (keys); 315 CHECK_VECTOR (keys);
316 key_count = XVECTOR (keys)->size; 316 key_count = XVECTOR_SIZE (keys);
317 } 317 }
318 318
319 /* Save this now, since use of minibuffer will clobber it. */ 319 /* Save this now, since use of minibuffer will clobber it. */
diff --git a/src/ccl.c b/src/ccl.c
index d1ac29778a8..bebf15e496e 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1924,7 +1924,7 @@ setup_ccl_program (ccl, ccl_prog)
1924 if (! VECTORP (ccl_prog)) 1924 if (! VECTORP (ccl_prog))
1925 return -1; 1925 return -1;
1926 vp = XVECTOR (ccl_prog); 1926 vp = XVECTOR (ccl_prog);
1927 ccl->size = vp->size; 1927 ccl->size = vp->header.size;
1928 ccl->prog = vp->contents; 1928 ccl->prog = vp->contents;
1929 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]); 1929 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
1930 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]); 1930 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]);
diff --git a/src/character.c b/src/character.c
index b9ba15d1b0f..ba6fb4ff098 100644
--- a/src/character.c
+++ b/src/character.c
@@ -411,7 +411,7 @@ c_string_width (const unsigned char *str, int len, int precision, int *nchars, i
411 { 411 {
412 val = DISP_CHAR_VECTOR (dp, c); 412 val = DISP_CHAR_VECTOR (dp, c);
413 if (VECTORP (val)) 413 if (VECTORP (val))
414 thiswidth = XVECTOR (val)->size; 414 thiswidth = XVECTOR_SIZE (val);
415 else 415 else
416 thiswidth = CHAR_WIDTH (c); 416 thiswidth = CHAR_WIDTH (c);
417 } 417 }
@@ -503,7 +503,7 @@ lisp_string_width (string, precision, nchars, nbytes)
503 { 503 {
504 val = DISP_CHAR_VECTOR (dp, c); 504 val = DISP_CHAR_VECTOR (dp, c);
505 if (VECTORP (val)) 505 if (VECTORP (val))
506 thiswidth = XVECTOR (val)->size; 506 thiswidth = XVECTOR_SIZE (val);
507 else 507 else
508 thiswidth = CHAR_WIDTH (c); 508 thiswidth = CHAR_WIDTH (c);
509 } 509 }
diff --git a/src/chartab.c b/src/chartab.c
index 978c4b8b678..c4cf6253a8b 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -152,7 +152,7 @@ copy_char_table (table)
152 Lisp_Object table; 152 Lisp_Object table;
153{ 153{
154 Lisp_Object copy; 154 Lisp_Object copy;
155 int size = XCHAR_TABLE (table)->size & PSEUDOVECTOR_SIZE_MASK; 155 int size = XCHAR_TABLE (table)->header.size & PSEUDOVECTOR_SIZE_MASK;
156 int i; 156 int i;
157 157
158 copy = Fmake_vector (make_number (size), Qnil); 158 copy = Fmake_vector (make_number (size), Qnil);
diff --git a/src/coding.c b/src/coding.c
index b20a72ca678..555e6623383 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7339,7 +7339,7 @@ handle_composition_annotation (pos, limit, coding, buf, stop)
7339 components = COMPOSITION_COMPONENTS (prop); 7339 components = COMPOSITION_COMPONENTS (prop);
7340 if (VECTORP (components)) 7340 if (VECTORP (components))
7341 { 7341 {
7342 len = XVECTOR (components)->size; 7342 len = XVECTOR_SIZE (components);
7343 for (i = 0; i < len; i++) 7343 for (i = 0; i < len; i++)
7344 *buf++ = XINT (AREF (components, i)); 7344 *buf++ = XINT (AREF (components, i));
7345 } 7345 }
diff --git a/src/composite.c b/src/composite.c
index a9376c0ec2d..ec2595813aa 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -300,7 +300,7 @@ get_composition_id (charpos, bytepos, nchars, prop, string)
300 } 300 }
301 else if (VECTORP (components) || CONSP (components)) 301 else if (VECTORP (components) || CONSP (components))
302 { 302 {
303 int len = XVECTOR (key)->size; 303 EMACS_UINT len = XVECTOR_SIZE (key);
304 304
305 /* The number of elements should be odd. */ 305 /* The number of elements should be odd. */
306 if ((len % 2) == 0) 306 if ((len % 2) == 0)
@@ -333,8 +333,8 @@ get_composition_id (charpos, bytepos, nchars, prop, string)
333 : COMPOSITION_WITH_RULE_ALTCHARS)); 333 : COMPOSITION_WITH_RULE_ALTCHARS));
334 cmp->hash_index = hash_index; 334 cmp->hash_index = hash_index;
335 glyph_len = (cmp->method == COMPOSITION_WITH_RULE_ALTCHARS 335 glyph_len = (cmp->method == COMPOSITION_WITH_RULE_ALTCHARS
336 ? (XVECTOR (key)->size + 1) / 2 336 ? (XVECTOR_SIZE (key) + 1) / 2
337 : XVECTOR (key)->size); 337 : XVECTOR_SIZE (key));
338 cmp->glyph_len = glyph_len; 338 cmp->glyph_len = glyph_len;
339 cmp->offsets = (short *) xmalloc (sizeof (short) * glyph_len * 2); 339 cmp->offsets = (short *) xmalloc (sizeof (short) * glyph_len * 2);
340 cmp->font = NULL; 340 cmp->font = NULL;
diff --git a/src/data.c b/src/data.c
index 0c7cb241568..79ae01f26f4 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1402,7 +1402,7 @@ for this variable. */)
1402 { 1402 {
1403 struct buffer *b; 1403 struct buffer *b;
1404 1404
1405 for (b = all_buffers; b; b = b->next) 1405 for (b = all_buffers; b; b = b->header.next.buffer)
1406 if (!PER_BUFFER_VALUE_P (b, idx)) 1406 if (!PER_BUFFER_VALUE_P (b, idx))
1407 PER_BUFFER_VALUE (b, offset) = value; 1407 PER_BUFFER_VALUE (b, offset) = value;
1408 } 1408 }
@@ -2029,9 +2029,9 @@ or a byte-code object. IDX starts at 0. */)
2029 { 2029 {
2030 int size = 0; 2030 int size = 0;
2031 if (VECTORP (array)) 2031 if (VECTORP (array))
2032 size = XVECTOR (array)->size; 2032 size = XVECTOR_SIZE (array);
2033 else if (COMPILEDP (array)) 2033 else if (COMPILEDP (array))
2034 size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK; 2034 size = XVECTOR_SIZE (array) & PSEUDOVECTOR_SIZE_MASK;
2035 else 2035 else
2036 wrong_type_argument (Qarrayp, array); 2036 wrong_type_argument (Qarrayp, array);
2037 2037
@@ -2058,7 +2058,7 @@ bool-vector. IDX starts at 0. */)
2058 2058
2059 if (VECTORP (array)) 2059 if (VECTORP (array))
2060 { 2060 {
2061 if (idxval < 0 || idxval >= XVECTOR (array)->size) 2061 if (idxval < 0 || idxval >= XVECTOR_SIZE (array))
2062 args_out_of_range (array, idx); 2062 args_out_of_range (array, idx);
2063 XVECTOR (array)->contents[idxval] = newelt; 2063 XVECTOR (array)->contents[idxval] = newelt;
2064 } 2064 }
diff --git a/src/dispnew.c b/src/dispnew.c
index 6062f40f598..60ce149da1c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6729,7 +6729,7 @@ pass nil for VARIABLE. */)
6729 state = frame_and_buffer_state; 6729 state = frame_and_buffer_state;
6730 6730
6731 vecp = XVECTOR (state)->contents; 6731 vecp = XVECTOR (state)->contents;
6732 end = vecp + XVECTOR (state)->size; 6732 end = vecp + XVECTOR_SIZE (state);
6733 6733
6734 FOR_EACH_FRAME (tail, frame) 6734 FOR_EACH_FRAME (tail, frame)
6735 { 6735 {
@@ -6780,8 +6780,8 @@ pass nil for VARIABLE. */)
6780 /* Reallocate the vector if data has grown to need it, 6780 /* Reallocate the vector if data has grown to need it,
6781 or if it has shrunk a lot. */ 6781 or if it has shrunk a lot. */
6782 if (! VECTORP (state) 6782 if (! VECTORP (state)
6783 || n > XVECTOR (state)->size 6783 || n > XVECTOR_SIZE (state)
6784 || n + 20 < XVECTOR (state)->size / 2) 6784 || n + 20 < XVECTOR_SIZE (state) / 2)
6785 /* Add 20 extra so we grow it less often. */ 6785 /* Add 20 extra so we grow it less often. */
6786 { 6786 {
6787 state = Fmake_vector (make_number (n + 20), Qlambda); 6787 state = Fmake_vector (make_number (n + 20), Qlambda);
@@ -6811,11 +6811,11 @@ pass nil for VARIABLE. */)
6811 /* Fill up the vector with lambdas (always at least one). */ 6811 /* Fill up the vector with lambdas (always at least one). */
6812 *vecp++ = Qlambda; 6812 *vecp++ = Qlambda;
6813 while (vecp - XVECTOR (state)->contents 6813 while (vecp - XVECTOR (state)->contents
6814 < XVECTOR (state)->size) 6814 < XVECTOR_SIZE (state))
6815 *vecp++ = Qlambda; 6815 *vecp++ = Qlambda;
6816 /* Make sure we didn't overflow the vector. */ 6816 /* Make sure we didn't overflow the vector. */
6817 if (vecp - XVECTOR (state)->contents 6817 if (vecp - XVECTOR (state)->contents
6818 > XVECTOR (state)->size) 6818 > XVECTOR_SIZE (state))
6819 abort (); 6819 abort ();
6820 return Qt; 6820 return Qt;
6821} 6821}
diff --git a/src/disptab.h b/src/disptab.h
index 92a42702187..0e9978a7bdb 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -62,7 +62,7 @@ extern Lisp_Object Vglyph_table;
62/* Return the current length of the GLYPH table, 62/* Return the current length of the GLYPH table,
63 or 0 if the table isn't currently valid. */ 63 or 0 if the table isn't currently valid. */
64#define GLYPH_TABLE_LENGTH \ 64#define GLYPH_TABLE_LENGTH \
65 ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->size : 0) 65 ((VECTORP (Vglyph_table)) ? XVECTOR_SIZE (Vglyph_table) : 0)
66 66
67/* Return the current base (for indexing) of the GLYPH table, 67/* Return the current base (for indexing) of the GLYPH table,
68 or 0 if the table isn't currently valid. */ 68 or 0 if the table isn't currently valid. */
diff --git a/src/doc.c b/src/doc.c
index 9b72b17cffa..d22c3bf872b 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -809,7 +809,7 @@ a new string, without any text properties, is returned. */)
809 do_remap: 809 do_remap:
810 tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil); 810 tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil);
811 811
812 if (VECTORP (tem) && XVECTOR (tem)->size > 1 812 if (VECTORP (tem) && XVECTOR_SIZE (tem) > 1
813 && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1)) 813 && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1))
814 && follow_remap) 814 && follow_remap)
815 { 815 {
diff --git a/src/fns.c b/src/fns.c
index 064c4d270e9..0bf38fd472a 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -27,11 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include <time.h> 27#include <time.h>
28#include <setjmp.h> 28#include <setjmp.h>
29 29
30/* Note on some machines this defines `vector' as a typedef,
31 so make sure we don't use that name in this file. */
32#undef vector
33#define vector *****
34
35#include "lisp.h" 30#include "lisp.h"
36#include "commands.h" 31#include "commands.h"
37#include "character.h" 32#include "character.h"
@@ -4022,9 +4017,9 @@ copy_hash_table (h1)
4022 struct Lisp_Vector *next; 4017 struct Lisp_Vector *next;
4023 4018
4024 h2 = allocate_hash_table (); 4019 h2 = allocate_hash_table ();
4025 next = h2->vec_next; 4020 next = h2->header.next.vector;
4026 bcopy (h1, h2, sizeof *h2); 4021 bcopy (h1, h2, sizeof *h2);
4027 h2->vec_next = next; 4022 h2->header.next.vector = next;
4028 h2->key_and_value = Fcopy_sequence (h1->key_and_value); 4023 h2->key_and_value = Fcopy_sequence (h1->key_and_value);
4029 h2->hash = Fcopy_sequence (h1->hash); 4024 h2->hash = Fcopy_sequence (h1->hash);
4030 h2->next = Fcopy_sequence (h1->next); 4025 h2->next = Fcopy_sequence (h1->next);
@@ -4379,7 +4374,7 @@ sweep_weak_hash_tables ()
4379 marked = 0; 4374 marked = 0;
4380 for (h = weak_hash_tables; h; h = h->next_weak) 4375 for (h = weak_hash_tables; h; h = h->next_weak)
4381 { 4376 {
4382 if (h->size & ARRAY_MARK_FLAG) 4377 if (h->header.size & ARRAY_MARK_FLAG)
4383 marked |= sweep_weak_table (h, 0); 4378 marked |= sweep_weak_table (h, 0);
4384 } 4379 }
4385 } 4380 }
@@ -4390,7 +4385,7 @@ sweep_weak_hash_tables ()
4390 { 4385 {
4391 next = h->next_weak; 4386 next = h->next_weak;
4392 4387
4393 if (h->size & ARRAY_MARK_FLAG) 4388 if (h->header.size & ARRAY_MARK_FLAG)
4394 { 4389 {
4395 /* TABLE is marked as used. Sweep its contents. */ 4390 /* TABLE is marked as used. Sweep its contents. */
4396 if (h->count > 0) 4391 if (h->count > 0)
@@ -4513,7 +4508,7 @@ sxhash_bool_vector (vec)
4513 unsigned hash = XBOOL_VECTOR (vec)->size; 4508 unsigned hash = XBOOL_VECTOR (vec)->size;
4514 int i, n; 4509 int i, n;
4515 4510
4516 n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->vector_size); 4511 n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size);
4517 for (i = 0; i < n; ++i) 4512 for (i = 0; i < n; ++i)
4518 hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]); 4513 hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]);
4519 4514
diff --git a/src/font.c b/src/font.c
index 08309d3697b..ed2999b8923 100644
--- a/src/font.c
+++ b/src/font.c
@@ -269,7 +269,7 @@ font_intern_prop (str, len, force_symbol)
269 /* The following code is copied from the function intern (in 269 /* The following code is copied from the function intern (in
270 lread.c), and modified to suite our purpose. */ 270 lread.c), and modified to suite our purpose. */
271 obarray = Vobarray; 271 obarray = Vobarray;
272 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 272 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
273 obarray = check_obarray (obarray); 273 obarray = check_obarray (obarray);
274 parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes); 274 parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes);
275 if (len == nchars || len != nbytes) 275 if (len == nchars || len != nbytes)
diff --git a/src/font.h b/src/font.h
index 208c42617e9..7471464bb9b 100644
--- a/src/font.h
+++ b/src/font.h
@@ -247,8 +247,7 @@ extern Lisp_Object Qja, Qko;
247 247
248struct font_spec 248struct font_spec
249{ 249{
250 EMACS_UINT size; 250 struct vectorlike_header header;
251 struct Lisp_Vector *next;
252 Lisp_Object props[FONT_SPEC_MAX]; 251 Lisp_Object props[FONT_SPEC_MAX];
253}; 252};
254 253
@@ -256,8 +255,7 @@ struct font_spec
256 255
257struct font_entity 256struct font_entity
258{ 257{
259 EMACS_UINT size; 258 struct vectorlike_header header;
260 struct Lisp_Vector *next;
261 Lisp_Object props[FONT_ENTITY_MAX]; 259 Lisp_Object props[FONT_ENTITY_MAX];
262}; 260};
263 261
@@ -270,8 +268,7 @@ struct font_entity
270 268
271struct font 269struct font
272{ 270{
273 EMACS_UINT size; 271 struct vectorlike_header header;
274 struct Lisp_Vector *next;
275 272
276 /* All Lisp_Object components must come first. 273 /* All Lisp_Object components must come first.
277 That ensures they are all aligned normally. */ 274 That ensures they are all aligned normally. */
diff --git a/src/frame.h b/src/frame.h
index c236304937b..194c4410fa8 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -93,8 +93,7 @@ struct font_driver_list;
93 93
94struct frame 94struct frame
95{ 95{
96 EMACS_UINT size; 96 struct vectorlike_header header;
97 struct Lisp_Vector *next;
98 97
99 /* All Lisp_Object components must come first. 98 /* All Lisp_Object components must come first.
100 That ensures they are all aligned normally. */ 99 That ensures they are all aligned normally. */
diff --git a/src/fringe.c b/src/fringe.c
index 861aa6e9487..880fe2c6e42 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1569,7 +1569,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1569 if (STRINGP (bits)) 1569 if (STRINGP (bits))
1570 h = SCHARS (bits); 1570 h = SCHARS (bits);
1571 else if (VECTORP (bits)) 1571 else if (VECTORP (bits))
1572 h = XVECTOR (bits)->size; 1572 h = XVECTOR_SIZE (bits);
1573 else 1573 else
1574 wrong_type_argument (Qsequencep, bits); 1574 wrong_type_argument (Qsequencep, bits);
1575 1575
diff --git a/src/image.c b/src/image.c
index b814b795fab..5a1be6e4747 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2459,7 +2459,7 @@ xbm_image_p (object)
2459 int i; 2459 int i;
2460 2460
2461 /* Number of elements of the vector must be >= height. */ 2461 /* Number of elements of the vector must be >= height. */
2462 if (XVECTOR (data)->size < height) 2462 if (XVECTOR_SIZE (data) < height)
2463 return 0; 2463 return 0;
2464 2464
2465 /* Each string or bool-vector in data must be large enough 2465 /* Each string or bool-vector in data must be large enough
@@ -8083,7 +8083,7 @@ gs_image_p (object)
8083 } 8083 }
8084 else if (VECTORP (tem)) 8084 else if (VECTORP (tem))
8085 { 8085 {
8086 if (XVECTOR (tem)->size != 4) 8086 if (XVECTOR_SIZE (tem) != 4)
8087 return 0; 8087 return 0;
8088 for (i = 0; i < 4; ++i) 8088 for (i = 0; i < 4; ++i)
8089 if (!INTEGERP (XVECTOR (tem)->contents[i])) 8089 if (!INTEGERP (XVECTOR (tem)->contents[i]))
diff --git a/src/indent.c b/src/indent.c
index e92e6b2776c..e965daf08c8 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -101,7 +101,7 @@ character_width (c, dp)
101 /* Everything can be handled by the display table, if it's 101 /* Everything can be handled by the display table, if it's
102 present and the element is right. */ 102 present and the element is right. */
103 if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt))) 103 if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt)))
104 return XVECTOR (elt)->size; 104 return XVECTOR_SIZE (elt);
105 105
106 /* Some characters are special. */ 106 /* Some characters are special. */
107 if (c == '\n' || c == '\t' || c == '\015') 107 if (c == '\n' || c == '\t' || c == '\015')
@@ -131,7 +131,7 @@ disptab_matches_widthtab (disptab, widthtab)
131{ 131{
132 int i; 132 int i;
133 133
134 if (widthtab->size != 256) 134 if (widthtab->header.size != 256)
135 abort (); 135 abort ();
136 136
137 for (i = 0; i < 256; i++) 137 for (i = 0; i < 256; i++)
@@ -155,7 +155,7 @@ recompute_width_table (buf, disptab)
155 if (!VECTORP (buf->width_table)) 155 if (!VECTORP (buf->width_table))
156 buf->width_table = Fmake_vector (make_number (256), make_number (0)); 156 buf->width_table = Fmake_vector (make_number (256), make_number (0));
157 widthtab = XVECTOR (buf->width_table); 157 widthtab = XVECTOR (buf->width_table);
158 if (widthtab->size != 256) 158 if (widthtab->header.size != 256)
159 abort (); 159 abort ();
160 160
161 for (i = 0; i < 256; i++) 161 for (i = 0; i < 256; i++)
@@ -301,7 +301,7 @@ skip_invisible (pos, next_boundary_p, to, window)
301 else \ 301 else \
302 { \ 302 { \
303 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \ 303 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \
304 width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \ 304 width = XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c)); \
305 else \ 305 else \
306 width = CHAR_WIDTH (c); \ 306 width = CHAR_WIDTH (c); \
307 if (width > 1) \ 307 if (width > 1) \
@@ -786,7 +786,7 @@ string_display_width (string, beg, end)
786 786
787 c = *--ptr; 787 c = *--ptr;
788 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) 788 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
789 col += XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; 789 col += XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c));
790 else if (c >= 040 && c < 0177) 790 else if (c >= 040 && c < 0177)
791 col++; 791 col++;
792 else if (c == '\n') 792 else if (c == '\n')
@@ -1159,7 +1159,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
1159 : !NILP (current_buffer->selective_display) ? -1 : 0); 1159 : !NILP (current_buffer->selective_display) ? -1 : 0);
1160 int selective_rlen 1160 int selective_rlen
1161 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) 1161 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
1162 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0); 1162 ? XVECTOR_SIZE (DISP_INVIS_VECTOR (dp)) : 0);
1163 /* The next location where the `invisible' property changes, or an 1163 /* The next location where the `invisible' property changes, or an
1164 overlay starts or ends. */ 1164 overlay starts or ends. */
1165 EMACS_INT next_boundary = from; 1165 EMACS_INT next_boundary = from;
diff --git a/src/keyboard.c b/src/keyboard.c
index 6a63caa15d3..09564418ddf 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -137,7 +137,7 @@ int raw_keybuf_count;
137Lisp_Object Vthis_command_keys_shift_translated; 137Lisp_Object Vthis_command_keys_shift_translated;
138 138
139#define GROW_RAW_KEYBUF \ 139#define GROW_RAW_KEYBUF \
140 if (raw_keybuf_count == XVECTOR (raw_keybuf)->size) \ 140 if (raw_keybuf_count == XVECTOR_SIZE (raw_keybuf)) \
141 raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \ 141 raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \
142 142
143/* Number of elements of this_command_keys 143/* Number of elements of this_command_keys
@@ -1774,7 +1774,7 @@ command_loop_1 ()
1774 if (PT == last_point_position + 1 1774 if (PT == last_point_position + 1
1775 && (dp 1775 && (dp
1776 ? (VECTORP (DISP_CHAR_VECTOR (dp, lose)) 1776 ? (VECTORP (DISP_CHAR_VECTOR (dp, lose))
1777 ? XVECTOR (DISP_CHAR_VECTOR (dp, lose))->size == 1 1777 ? XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, lose)) == 1
1778 : (NILP (DISP_CHAR_VECTOR (dp, lose)) 1778 : (NILP (DISP_CHAR_VECTOR (dp, lose))
1779 && (lose >= 0x20 && lose < 0x7f))) 1779 && (lose >= 0x20 && lose < 0x7f)))
1780 : (lose >= 0x20 && lose < 0x7f)) 1780 : (lose >= 0x20 && lose < 0x7f))
@@ -1814,7 +1814,7 @@ command_loop_1 ()
1814 if (PT == last_point_position - 1 1814 if (PT == last_point_position - 1
1815 && (dp 1815 && (dp
1816 ? (VECTORP (DISP_CHAR_VECTOR (dp, lose)) 1816 ? (VECTORP (DISP_CHAR_VECTOR (dp, lose))
1817 ? XVECTOR (DISP_CHAR_VECTOR (dp, lose))->size == 1 1817 ? XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, lose)) == 1
1818 : (NILP (DISP_CHAR_VECTOR (dp, lose)) 1818 : (NILP (DISP_CHAR_VECTOR (dp, lose))
1819 && (lose >= 0x20 && lose < 0x7f))) 1819 && (lose >= 0x20 && lose < 0x7f)))
1820 : (lose >= 0x20 && lose < 0x7f)) 1820 : (lose >= 0x20 && lose < 0x7f))
@@ -3203,7 +3203,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
3203 if ((STRINGP (current_kboard->Vkeyboard_translate_table) 3203 if ((STRINGP (current_kboard->Vkeyboard_translate_table)
3204 && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) 3204 && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
3205 || (VECTORP (current_kboard->Vkeyboard_translate_table) 3205 || (VECTORP (current_kboard->Vkeyboard_translate_table)
3206 && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) 3206 && XVECTOR_SIZE (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
3207 || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table) 3207 || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table)
3208 && CHARACTERP (c))) 3208 && CHARACTERP (c)))
3209 { 3209 {
@@ -4552,7 +4552,7 @@ timer_start_idle ()
4552 4552
4553 timer = XCAR (timers); 4553 timer = XCAR (timers);
4554 4554
4555 if (!VECTORP (timer) || XVECTOR (timer)->size != 8) 4555 if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
4556 continue; 4556 continue;
4557 XVECTOR (timer)->contents[0] = Qnil; 4557 XVECTOR (timer)->contents[0] = Qnil;
4558 } 4558 }
@@ -4646,7 +4646,7 @@ timer_check_2 ()
4646 if (!NILP (timers)) 4646 if (!NILP (timers))
4647 { 4647 {
4648 timer = XCAR (timers); 4648 timer = XCAR (timers);
4649 if (!VECTORP (timer) || XVECTOR (timer)->size != 8) 4649 if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
4650 { 4650 {
4651 timers = XCDR (timers); 4651 timers = XCDR (timers);
4652 continue; 4652 continue;
@@ -4664,7 +4664,7 @@ timer_check_2 ()
4664 if (!NILP (idle_timers)) 4664 if (!NILP (idle_timers))
4665 { 4665 {
4666 timer = XCAR (idle_timers); 4666 timer = XCAR (idle_timers);
4667 if (!VECTORP (timer) || XVECTOR (timer)->size != 8) 4667 if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
4668 { 4668 {
4669 idle_timers = XCDR (idle_timers); 4669 idle_timers = XCDR (idle_timers);
4670 continue; 4670 continue;
@@ -5830,7 +5830,7 @@ make_lispy_event (event)
5830 /* Find the menu bar item under `column'. */ 5830 /* Find the menu bar item under `column'. */
5831 item = Qnil; 5831 item = Qnil;
5832 items = FRAME_MENU_BAR_ITEMS (f); 5832 items = FRAME_MENU_BAR_ITEMS (f);
5833 for (i = 0; i < XVECTOR (items)->size; i += 4) 5833 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
5834 { 5834 {
5835 Lisp_Object pos, string; 5835 Lisp_Object pos, string;
5836 string = AREF (items, i + 1); 5836 string = AREF (items, i + 1);
@@ -6025,7 +6025,7 @@ make_lispy_event (event)
6025 Qmouse_click, Vlispy_mouse_stem, 6025 Qmouse_click, Vlispy_mouse_stem,
6026 NULL, 6026 NULL,
6027 &mouse_syms, 6027 &mouse_syms,
6028 XVECTOR (mouse_syms)->size); 6028 XVECTOR_SIZE (mouse_syms));
6029 if (event->modifiers & drag_modifier) 6029 if (event->modifiers & drag_modifier)
6030 return Fcons (head, 6030 return Fcons (head,
6031 Fcons (start_pos, 6031 Fcons (start_pos,
@@ -6198,7 +6198,7 @@ make_lispy_event (event)
6198 Qmouse_click, 6198 Qmouse_click,
6199 Vlispy_mouse_stem, 6199 Vlispy_mouse_stem,
6200 NULL, &mouse_syms, 6200 NULL, &mouse_syms,
6201 XVECTOR (mouse_syms)->size); 6201 XVECTOR_SIZE (mouse_syms));
6202 return Fcons (head, Fcons (position, Qnil)); 6202 return Fcons (head, Fcons (position, Qnil));
6203 } 6203 }
6204 6204
@@ -6318,7 +6318,7 @@ make_lispy_event (event)
6318 Qmouse_click, Vlispy_mouse_stem, 6318 Qmouse_click, Vlispy_mouse_stem,
6319 NULL, 6319 NULL,
6320 &mouse_syms, 6320 &mouse_syms,
6321 XVECTOR (mouse_syms)->size); 6321 XVECTOR_SIZE (mouse_syms));
6322 6322
6323 if (event->modifiers & drag_modifier) 6323 if (event->modifiers & drag_modifier)
6324 return Fcons (head, 6324 return Fcons (head,
@@ -6825,7 +6825,7 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
6825 else 6825 else
6826 { 6826 {
6827 if (! VECTORP (*symbol_table) 6827 if (! VECTORP (*symbol_table)
6828 || XVECTOR (*symbol_table)->size != table_size) 6828 || XVECTOR_SIZE (*symbol_table) != table_size)
6829 { 6829 {
6830 Lisp_Object size; 6830 Lisp_Object size;
6831 6831
@@ -7865,7 +7865,7 @@ menu_bar_items (old)
7865 7865
7866 /* Add nil, nil, nil, nil at the end. */ 7866 /* Add nil, nil, nil, nil at the end. */
7867 i = menu_bar_items_index; 7867 i = menu_bar_items_index;
7868 if (i + 4 > XVECTOR (menu_bar_items_vector)->size) 7868 if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
7869 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); 7869 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
7870 /* Add this item. */ 7870 /* Add this item. */
7871 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7871 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
@@ -7937,7 +7937,7 @@ menu_bar_item (key, item, dummy1, dummy2)
7937 if (i == menu_bar_items_index) 7937 if (i == menu_bar_items_index)
7938 { 7938 {
7939 /* If vector is too small, get a bigger one. */ 7939 /* If vector is too small, get a bigger one. */
7940 if (i + 4 > XVECTOR (menu_bar_items_vector)->size) 7940 if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
7941 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); 7941 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
7942 /* Add this item. */ 7942 /* Add this item. */
7943 XVECTOR (menu_bar_items_vector)->contents[i++] = key; 7943 XVECTOR (menu_bar_items_vector)->contents[i++] = key;
@@ -8573,7 +8573,7 @@ parse_tool_bar_item (key, item)
8573 } 8573 }
8574 else if (EQ (key, QCimage) 8574 else if (EQ (key, QCimage)
8575 && (CONSP (value) 8575 && (CONSP (value)
8576 || (VECTORP (value) && XVECTOR (value)->size == 4))) 8576 || (VECTORP (value) && XVECTOR_SIZE (value) == 4)))
8577 /* Value is either a single image specification or a vector 8577 /* Value is either a single image specification or a vector
8578 of 4 such specifications for the different button states. */ 8578 of 4 such specifications for the different button states. */
8579 PROP (TOOL_BAR_ITEM_IMAGES) = value; 8579 PROP (TOOL_BAR_ITEM_IMAGES) = value;
@@ -8634,10 +8634,10 @@ append_tool_bar_item ()
8634 8634
8635 /* Enlarge tool_bar_items_vector if necessary. */ 8635 /* Enlarge tool_bar_items_vector if necessary. */
8636 if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS 8636 if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
8637 >= XVECTOR (tool_bar_items_vector)->size) 8637 >= XVECTOR_SIZE (tool_bar_items_vector))
8638 tool_bar_items_vector 8638 tool_bar_items_vector
8639 = larger_vector (tool_bar_items_vector, 8639 = larger_vector (tool_bar_items_vector,
8640 2 * XVECTOR (tool_bar_items_vector)->size, Qnil); 8640 2 * XVECTOR_SIZE (tool_bar_items_vector), Qnil);
8641 8641
8642 /* Append entries from tool_bar_item_properties to the end of 8642 /* Append entries from tool_bar_item_properties to the end of
8643 tool_bar_items_vector. */ 8643 tool_bar_items_vector. */
@@ -8966,7 +8966,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
8966 } 8966 }
8967 8967
8968 /* Move past this element. */ 8968 /* Move past this element. */
8969 if (idx >= 0 && idx + 1 >= XVECTOR (vector)->size) 8969 if (idx >= 0 && idx + 1 >= XVECTOR_SIZE (vector))
8970 /* Handle reaching end of dense table. */ 8970 /* Handle reaching end of dense table. */
8971 idx = -1; 8971 idx = -1;
8972 if (idx >= 0) 8972 if (idx >= 0)
@@ -10244,7 +10244,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
10244 /* Treat uppercase keys as shifted. */ 10244 /* Treat uppercase keys as shifted. */
10245 || (INTEGERP (key) 10245 || (INTEGERP (key)
10246 && (KEY_TO_CHAR (key) 10246 && (KEY_TO_CHAR (key)
10247 < XCHAR_TABLE (current_buffer->downcase_table)->size) 10247 < XCHAR_TABLE (current_buffer->downcase_table)->header.size)
10248 && UPPERCASEP (KEY_TO_CHAR (key)))) 10248 && UPPERCASEP (KEY_TO_CHAR (key))))
10249 { 10249 {
10250 Lisp_Object new_key 10250 Lisp_Object new_key
@@ -10642,7 +10642,7 @@ give to the command you invoke, if it asks for an argument. */)
10642 this_single_command_key_start = 0; 10642 this_single_command_key_start = 0;
10643 10643
10644 keys = XVECTOR (saved_keys)->contents; 10644 keys = XVECTOR (saved_keys)->contents;
10645 for (i = 0; i < XVECTOR (saved_keys)->size; i++) 10645 for (i = 0; i < XVECTOR_SIZE (saved_keys); i++)
10646 add_command_key (keys[i]); 10646 add_command_key (keys[i]);
10647 10647
10648 for (i = 0; i < SCHARS (function); i++) 10648 for (i = 0; i < SCHARS (function); i++)
@@ -10939,7 +10939,7 @@ KEEP-RECORD is non-nil. */)
10939 10939
10940 if (NILP (keep_record)) 10940 if (NILP (keep_record))
10941 { 10941 {
10942 for (i = 0; i < XVECTOR (recent_keys)->size; ++i) 10942 for (i = 0; i < XVECTOR_SIZE (recent_keys); ++i)
10943 XVECTOR (recent_keys)->contents[i] = Qnil; 10943 XVECTOR (recent_keys)->contents[i] = Qnil;
10944 total_keys = 0; 10944 total_keys = 0;
10945 recent_keys_index = 0; 10945 recent_keys_index = 0;
diff --git a/src/keymap.c b/src/keymap.c
index b3c1400a64c..dec53cbd8e1 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -421,7 +421,7 @@ Return PARENT. PARENT should be nil or another keymap. */)
421 XCDR (XCAR (list))); 421 XCDR (XCAR (list)));
422 422
423 if (VECTORP (XCAR (list))) 423 if (VECTORP (XCAR (list)))
424 for (i = 0; i < XVECTOR (XCAR (list))->size; i++) 424 for (i = 0; i < XVECTOR_SIZE (XCAR (list)); i++)
425 if (CONSP (XVECTOR (XCAR (list))->contents[i])) 425 if (CONSP (XVECTOR (XCAR (list))->contents[i]))
426 fix_submap_inheritance (keymap, make_number (i), 426 fix_submap_inheritance (keymap, make_number (i),
427 XVECTOR (XCAR (list))->contents[i]); 427 XVECTOR (XCAR (list))->contents[i]);
@@ -2337,7 +2337,7 @@ spaces are put between sequence elements, etc. */)
2337 if (STRINGP (list)) 2337 if (STRINGP (list))
2338 size = SCHARS (list); 2338 size = SCHARS (list);
2339 else if (VECTORP (list)) 2339 else if (VECTORP (list))
2340 size = XVECTOR (list)->size; 2340 size = XVECTOR_SIZE (list);
2341 else if (CONSP (list)) 2341 else if (CONSP (list))
2342 size = XINT (Flength (list)); 2342 size = XINT (Flength (list));
2343 else 2343 else
@@ -3257,7 +3257,7 @@ key binding\n\
3257 3257
3258 elt = XCAR (list); 3258 elt = XCAR (list);
3259 prefix = Fcar (elt); 3259 prefix = Fcar (elt);
3260 if (XVECTOR (prefix)->size >= 1) 3260 if (XVECTOR_SIZE (prefix) >= 1)
3261 { 3261 {
3262 tem = Faref (prefix, make_number (0)); 3262 tem = Faref (prefix, make_number (0));
3263 if (EQ (tem, Qmenu_bar)) 3263 if (EQ (tem, Qmenu_bar))
@@ -3300,7 +3300,7 @@ key binding\n\
3300 /* If the sequence by which we reach this keymap is zero-length, 3300 /* If the sequence by which we reach this keymap is zero-length,
3301 then the shadow map for this keymap is just SHADOW. */ 3301 then the shadow map for this keymap is just SHADOW. */
3302 if ((STRINGP (prefix) && SCHARS (prefix) == 0) 3302 if ((STRINGP (prefix) && SCHARS (prefix) == 0)
3303 || (VECTORP (prefix) && XVECTOR (prefix)->size == 0)) 3303 || (VECTORP (prefix) && XVECTOR_SIZE (prefix) == 0))
3304 ; 3304 ;
3305 /* If the sequence by which we reach this keymap actually has 3305 /* If the sequence by which we reach this keymap actually has
3306 some elements, then the sequence's definition in SHADOW is 3306 some elements, then the sequence's definition in SHADOW is
@@ -3748,7 +3748,7 @@ describe_vector (vector, prefix, args, elt_describer,
3748 if (CHAR_TABLE_P (vector)) 3748 if (CHAR_TABLE_P (vector))
3749 stop = MAX_5_BYTE_CHAR + 1, to = MAX_CHAR + 1; 3749 stop = MAX_5_BYTE_CHAR + 1, to = MAX_CHAR + 1;
3750 else 3750 else
3751 stop = to = XVECTOR (vector)->size; 3751 stop = to = XVECTOR_SIZE (vector);
3752 3752
3753 for (i = from; ; i++) 3753 for (i = from; ; i++)
3754 { 3754 {
diff --git a/src/lisp.h b/src/lisp.h
index 34330b0e6c6..adda5455390 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -550,6 +550,12 @@ extern Lisp_Object make_number P_ ((EMACS_INT));
550#define XSYMBOL(a) (eassert (SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a)) 550#define XSYMBOL(a) (eassert (SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
551#define XFLOAT(a) (eassert (FLOATP(a)),(struct Lisp_Float *) XPNTR(a)) 551#define XFLOAT(a) (eassert (FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
552 552
553/* Extract the size field of a vector or vector-like object. */
554
555#define XVECTOR_SIZE(a) (XVECTOR (a)->header.size + 0)
556#define XVECTORLIKE_HEADER_SIZE(a) \
557 (((struct vectorlike_header *) XPNTR (a))->size + 0)
558
553/* Misc types. */ 559/* Misc types. */
554 560
555#define XMISC(a) ((union Lisp_Misc *) XPNTR(a)) 561#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
@@ -595,17 +601,24 @@ extern Lisp_Object make_number P_ ((EMACS_INT));
595 601
596/* Pseudovector types. */ 602/* Pseudovector types. */
597 603
598#define XSETPVECTYPE(v,code) ((v)->size |= PSEUDOVECTOR_FLAG | (code)) 604#define XSETPVECTYPE(v, code) XSETTYPED_PVECTYPE(v, header.size, code)
605#define XSETTYPED_PVECTYPE(v, size_member, code) \
606 ((v)->size_member |= PSEUDOVECTOR_FLAG | (code))
607#define XSETPVECTYPESIZE(v, code, sizeval) \
608 ((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval))
599#define XSETPSEUDOVECTOR(a, b, code) \ 609#define XSETPSEUDOVECTOR(a, b, code) \
610 XSETTYPED_PSEUDOVECTOR(a, b, XVECTORLIKE_HEADER_SIZE (a), code)
611#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \
600 (XSETVECTOR (a, b), \ 612 (XSETVECTOR (a, b), \
601 eassert ((XVECTOR (a)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \ 613 eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \
602 == (PSEUDOVECTOR_FLAG | (code)))) 614 == (PSEUDOVECTOR_FLAG | (code))))
603#define XSETWINDOW_CONFIGURATION(a, b) \ 615#define XSETWINDOW_CONFIGURATION(a, b) \
604 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION)) 616 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
605#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS)) 617#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
606#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) 618#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
607#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) 619#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
608#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) 620#define XSETSUBR(a, b) \
621 XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR)
609#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) 622#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
610#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) 623#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
611#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) 624#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
@@ -615,7 +628,7 @@ extern Lisp_Object make_number P_ ((EMACS_INT));
615/* Convenience macros for dealing with Lisp arrays. */ 628/* Convenience macros for dealing with Lisp arrays. */
616 629
617#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX] 630#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
618#define ASIZE(ARRAY) XVECTOR ((ARRAY))->size 631#define ASIZE(ARRAY) XVECTOR_SIZE (ARRAY)
619/* The IDX==IDX tries to detect when the macro argument is side-effecting. */ 632/* The IDX==IDX tries to detect when the macro argument is side-effecting. */
620#define ASET(ARRAY, IDX, VAL) \ 633#define ASET(ARRAY, IDX, VAL) \
621 (eassert ((IDX) == (IDX)), \ 634 (eassert ((IDX) == (IDX)), \
@@ -780,11 +793,21 @@ struct Lisp_String
780#define OFFSETOF(type,field) \ 793#define OFFSETOF(type,field) \
781 ((int)((char*)&((type*)0)->field - (char*)0)) 794 ((int)((char*)&((type*)0)->field - (char*)0))
782#endif 795#endif
796/* Header of vector-like objects. This type documents the constraints on
797 layout of vectors and pseudovectors, and helps optimizing compilers not get
798 fooled by Emacs's type punning. */
799struct vectorlike_header
800 {
801 EMACS_UINT size;
802 union {
803 struct buffer *buffer;
804 struct Lisp_Vector *vector;
805 } next;
806 };
783 807
784struct Lisp_Vector 808struct Lisp_Vector
785 { 809 {
786 EMACS_UINT size; 810 struct vectorlike_header header;
787 struct Lisp_Vector *next;
788 Lisp_Object contents[1]; 811 Lisp_Object contents[1];
789 }; 812 };
790 813
@@ -820,7 +843,7 @@ struct Lisp_Vector
820/* Return the number of "extra" slots in the char table CT. */ 843/* Return the number of "extra" slots in the char table CT. */
821 844
822#define CHAR_TABLE_EXTRA_SLOTS(CT) \ 845#define CHAR_TABLE_EXTRA_SLOTS(CT) \
823 (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) 846 (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
824 847
825#ifdef __GNUC__ 848#ifdef __GNUC__
826 849
@@ -882,12 +905,11 @@ struct Lisp_Sub_Char_Table;
882 905
883struct Lisp_Char_Table 906struct Lisp_Char_Table
884 { 907 {
885 /* This is the vector's size field, which also holds the 908 /* HEADER.SIZE is the vector's size field, which also holds the
886 pseudovector type information. It holds the size, too. 909 pseudovector type information. It holds the size, too.
887 The size counts the defalt, parent, purpose, ascii, 910 The size counts the defalt, parent, purpose, ascii,
888 contents, and extras slots. */ 911 contents, and extras slots. */
889 EMACS_UINT size; 912 struct vectorlike_header header;
890 struct Lisp_Vector *next;
891 913
892 /* This holds a default value, 914 /* This holds a default value,
893 which is used whenever the value for a specific character is nil. */ 915 which is used whenever the value for a specific character is nil. */
@@ -914,10 +936,9 @@ struct Lisp_Char_Table
914 936
915struct Lisp_Sub_Char_Table 937struct Lisp_Sub_Char_Table
916 { 938 {
917 /* This is the vector's size field, which also holds the 939 /* HEADER.SIZE is the vector's size field, which also holds the
918 pseudovector type information. It holds the size, too. */ 940 pseudovector type information. It holds the size, too. */
919 EMACS_INT size; 941 struct vectorlike_header header;
920 struct Lisp_Vector *next;
921 942
922 /* Depth of this sub char-table. It should be 1, 2, or 3. A sub 943 /* Depth of this sub char-table. It should be 1, 2, or 3. A sub
923 char-table of depth 1 contains 16 elements, and each element 944 char-table of depth 1 contains 16 elements, and each element
@@ -936,10 +957,9 @@ struct Lisp_Sub_Char_Table
936/* A boolvector is a kind of vectorlike, with contents are like a string. */ 957/* A boolvector is a kind of vectorlike, with contents are like a string. */
937struct Lisp_Bool_Vector 958struct Lisp_Bool_Vector
938 { 959 {
939 /* This is the vector's size field. It doesn't have the real size, 960 /* HEADER.SIZE is the vector's size field. It doesn't have the real size,
940 just the subtype information. */ 961 just the subtype information. */
941 EMACS_UINT vector_size; 962 struct vectorlike_header header;
942 struct Lisp_Vector *next;
943 /* This is the size in bits. */ 963 /* This is the size in bits. */
944 EMACS_UINT size; 964 EMACS_UINT size;
945 /* This contains the actual bits, packed into bytes. */ 965 /* This contains the actual bits, packed into bytes. */
@@ -952,7 +972,7 @@ struct Lisp_Bool_Vector
952 972
953 This type is treated in most respects as a pseudovector, 973 This type is treated in most respects as a pseudovector,
954 but since we never dynamically allocate or free them, 974 but since we never dynamically allocate or free them,
955 we don't need a next-vector field. */ 975 we don't need a struct vectorlike_header and its 'next' field. */
956 976
957struct Lisp_Subr 977struct Lisp_Subr
958 { 978 {
@@ -1066,9 +1086,8 @@ struct Lisp_Symbol
1066 1086
1067struct Lisp_Hash_Table 1087struct Lisp_Hash_Table
1068{ 1088{
1069 /* Vector fields. The hash table code doesn't refer to these. */ 1089 /* This is for Lisp; the hash table code does not refer to it. */
1070 EMACS_UINT size; 1090 struct vectorlike_header header;
1071 struct Lisp_Vector *vec_next;
1072 1091
1073 /* Function used to compare keys. */ 1092 /* Function used to compare keys. */
1074 Lisp_Object test; 1093 Lisp_Object test;
@@ -1169,7 +1188,7 @@ struct Lisp_Hash_Table
1169 1188
1170/* Value is the size of hash table H. */ 1189/* Value is the size of hash table H. */
1171 1190
1172#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size 1191#define HASH_TABLE_SIZE(H) XVECTOR_SIZE ((H)->next)
1173 1192
1174/* Default size for hash tables if not specified. */ 1193/* Default size for hash tables if not specified. */
1175 1194
@@ -1551,7 +1570,7 @@ typedef struct {
1551#define CONSP(x) (XTYPE ((x)) == Lisp_Cons) 1570#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
1552 1571
1553#define FLOATP(x) (XTYPE ((x)) == Lisp_Float) 1572#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
1554#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG)) 1573#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR_SIZE (x) & PSEUDOVECTOR_FLAG))
1555#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay) 1574#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1556#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker) 1575#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1557#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd) 1576#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
@@ -1566,8 +1585,14 @@ typedef struct {
1566 1585
1567/* True if object X is a pseudovector whose code is CODE. */ 1586/* True if object X is a pseudovector whose code is CODE. */
1568#define PSEUDOVECTORP(x, code) \ 1587#define PSEUDOVECTORP(x, code) \
1588 TYPED_PSEUDOVECTORP(x, vectorlike_header, code)
1589
1590/* True if object X, with internal type struct T *, is a pseudovector whose
1591 code is CODE. */
1592#define TYPED_PSEUDOVECTORP(x, t, code) \
1569 (VECTORLIKEP (x) \ 1593 (VECTORLIKEP (x) \
1570 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \ 1594 && (((((struct t *) XPNTR (x))->size \
1595 & (PSEUDOVECTOR_FLAG | (code)))) \
1571 == (PSEUDOVECTOR_FLAG | (code)))) 1596 == (PSEUDOVECTOR_FLAG | (code))))
1572 1597
1573/* Test for specific pseudovector types. */ 1598/* Test for specific pseudovector types. */
@@ -1575,7 +1600,7 @@ typedef struct {
1575#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS) 1600#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
1576#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW) 1601#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
1577#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL) 1602#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
1578#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR) 1603#define SUBRP(x) TYPED_PSEUDOVECTORP (x, Lisp_Subr, PVEC_SUBR)
1579#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED) 1604#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
1580#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) 1605#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
1581#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE) 1606#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
diff --git a/src/lread.c b/src/lread.c
index 2da64632417..3d954ac282b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2433,7 +2433,7 @@ read1 (readcharfun, pch, first_in_list)
2433 { 2433 {
2434 Lisp_Object tmp; 2434 Lisp_Object tmp;
2435 tmp = read_vector (readcharfun, 0); 2435 tmp = read_vector (readcharfun, 0);
2436 if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS) 2436 if (XVECTOR_SIZE (tmp) < CHAR_TABLE_STANDARD_SLOTS)
2437 error ("Invalid size char-table"); 2437 error ("Invalid size char-table");
2438 XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE); 2438 XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE);
2439 return tmp; 2439 return tmp;
@@ -2452,7 +2452,7 @@ read1 (readcharfun, pch, first_in_list)
2452 depth = XINT (AREF (tmp, 0)); 2452 depth = XINT (AREF (tmp, 0));
2453 if (depth < 1 || depth > 3) 2453 if (depth < 1 || depth > 3)
2454 error ("Invalid depth in char-table"); 2454 error ("Invalid depth in char-table");
2455 size = XVECTOR (tmp)->size - 2; 2455 size = XVECTOR_SIZE (tmp) - 2;
2456 if (chartab_size [depth] != size) 2456 if (chartab_size [depth] != size)
2457 error ("Invalid size char-table"); 2457 error ("Invalid size char-table");
2458 XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE); 2458 XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
@@ -2503,7 +2503,7 @@ read1 (readcharfun, pch, first_in_list)
2503 build them using function calls. */ 2503 build them using function calls. */
2504 Lisp_Object tmp; 2504 Lisp_Object tmp;
2505 tmp = read_vector (readcharfun, 1); 2505 tmp = read_vector (readcharfun, 1);
2506 return Fmake_byte_code (XVECTOR (tmp)->size, 2506 return Fmake_byte_code (XVECTOR_SIZE (tmp),
2507 XVECTOR (tmp)->contents); 2507 XVECTOR (tmp)->contents);
2508 } 2508 }
2509 if (c == '(') 2509 if (c == '(')
@@ -3332,7 +3332,7 @@ read_vector (readcharfun, bytecodeflag)
3332 len = Flength (tem); 3332 len = Flength (tem);
3333 vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil)); 3333 vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil));
3334 3334
3335 size = XVECTOR (vector)->size; 3335 size = XVECTOR_SIZE (vector);
3336 ptr = XVECTOR (vector)->contents; 3336 ptr = XVECTOR (vector)->contents;
3337 for (i = 0; i < size; i++) 3337 for (i = 0; i < size; i++)
3338 { 3338 {
@@ -3601,7 +3601,7 @@ Lisp_Object
3601check_obarray (obarray) 3601check_obarray (obarray)
3602 Lisp_Object obarray; 3602 Lisp_Object obarray;
3603{ 3603{
3604 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3604 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
3605 { 3605 {
3606 /* If Vobarray is now invalid, force it to be valid. */ 3606 /* If Vobarray is now invalid, force it to be valid. */
3607 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray; 3607 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
@@ -3622,7 +3622,7 @@ intern (str)
3622 Lisp_Object obarray; 3622 Lisp_Object obarray;
3623 3623
3624 obarray = Vobarray; 3624 obarray = Vobarray;
3625 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3625 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
3626 obarray = check_obarray (obarray); 3626 obarray = check_obarray (obarray);
3627 tem = oblookup (obarray, str, len, len); 3627 tem = oblookup (obarray, str, len, len);
3628 if (SYMBOLP (tem)) 3628 if (SYMBOLP (tem))
@@ -3638,7 +3638,7 @@ intern_c_string (const char *str)
3638 Lisp_Object obarray; 3638 Lisp_Object obarray;
3639 3639
3640 obarray = Vobarray; 3640 obarray = Vobarray;
3641 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3641 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
3642 obarray = check_obarray (obarray); 3642 obarray = check_obarray (obarray);
3643 tem = oblookup (obarray, str, len, len); 3643 tem = oblookup (obarray, str, len, len);
3644 if (SYMBOLP (tem)) 3644 if (SYMBOLP (tem))
@@ -3831,10 +3831,10 @@ oblookup (obarray, ptr, size, size_byte)
3831 Lisp_Object bucket, tem; 3831 Lisp_Object bucket, tem;
3832 3832
3833 if (!VECTORP (obarray) 3833 if (!VECTORP (obarray)
3834 || (obsize = XVECTOR (obarray)->size) == 0) 3834 || (obsize = XVECTOR_SIZE (obarray)) == 0)
3835 { 3835 {
3836 obarray = check_obarray (obarray); 3836 obarray = check_obarray (obarray);
3837 obsize = XVECTOR (obarray)->size; 3837 obsize = XVECTOR_SIZE (obarray);
3838 } 3838 }
3839 /* This is sometimes needed in the middle of GC. */ 3839 /* This is sometimes needed in the middle of GC. */
3840 obsize &= ~ARRAY_MARK_FLAG; 3840 obsize &= ~ARRAY_MARK_FLAG;
@@ -3887,7 +3887,7 @@ map_obarray (obarray, fn, arg)
3887 register int i; 3887 register int i;
3888 register Lisp_Object tail; 3888 register Lisp_Object tail;
3889 CHECK_VECTOR (obarray); 3889 CHECK_VECTOR (obarray);
3890 for (i = XVECTOR (obarray)->size - 1; i >= 0; i--) 3890 for (i = XVECTOR_SIZE (obarray) - 1; i >= 0; i--)
3891 { 3891 {
3892 tail = XVECTOR (obarray)->contents[i]; 3892 tail = XVECTOR (obarray)->contents[i];
3893 if (SYMBOLP (tail)) 3893 if (SYMBOLP (tail))
@@ -3974,7 +3974,7 @@ defsubr (sname)
3974{ 3974{
3975 Lisp_Object sym; 3975 Lisp_Object sym;
3976 sym = intern_c_string (sname->symbol_name); 3976 sym = intern_c_string (sname->symbol_name);
3977 XSETPVECTYPE (sname, PVEC_SUBR); 3977 XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR);
3978 XSETSUBR (XSYMBOL (sym)->function, sname); 3978 XSETSUBR (XSYMBOL (sym)->function, sname);
3979} 3979}
3980 3980
diff --git a/src/minibuf.c b/src/minibuf.c
index 90df137411c..2b2d8dc81fb 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1326,7 +1326,7 @@ is used to further constrain the set of candidates. */)
1326 if (type == obarray_table) 1326 if (type == obarray_table)
1327 { 1327 {
1328 collection = check_obarray (collection); 1328 collection = check_obarray (collection);
1329 obsize = XVECTOR (collection)->size; 1329 obsize = XVECTOR_SIZE (collection);
1330 bucket = XVECTOR (collection)->contents[index]; 1330 bucket = XVECTOR (collection)->contents[index];
1331 } 1331 }
1332 1332
@@ -1590,7 +1590,7 @@ with a space are ignored unless STRING itself starts with a space. */)
1590 if (type == 2) 1590 if (type == 2)
1591 { 1591 {
1592 collection = check_obarray (collection); 1592 collection = check_obarray (collection);
1593 obsize = XVECTOR (collection)->size; 1593 obsize = XVECTOR_SIZE (collection);
1594 bucket = XVECTOR (collection)->contents[index]; 1594 bucket = XVECTOR (collection)->contents[index];
1595 } 1595 }
1596 1596
@@ -1889,7 +1889,7 @@ the values STRING, PREDICATE and `lambda'. */)
1889 1889
1890 if (completion_ignore_case && !SYMBOLP (tem)) 1890 if (completion_ignore_case && !SYMBOLP (tem))
1891 { 1891 {
1892 for (i = XVECTOR (collection)->size - 1; i >= 0; i--) 1892 for (i = XVECTOR_SIZE (collection) - 1; i >= 0; i--)
1893 { 1893 {
1894 tail = XVECTOR (collection)->contents[i]; 1894 tail = XVECTOR (collection)->contents[i];
1895 if (SYMBOLP (tail)) 1895 if (SYMBOLP (tail))
diff --git a/src/print.c b/src/print.c
index 682212d5e39..8ffe7b544b0 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1365,7 +1365,7 @@ print_preprocess (obj)
1365 /* Initialize the table. */ 1365 /* Initialize the table. */
1366 Vprint_number_table = Fmake_vector (make_number (40), Qnil); 1366 Vprint_number_table = Fmake_vector (make_number (40), Qnil);
1367 } 1367 }
1368 else if (XVECTOR (Vprint_number_table)->size == print_number_index * 2) 1368 else if (XVECTOR_SIZE (Vprint_number_table) == print_number_index * 2)
1369 { 1369 {
1370 /* Reallocate the table. */ 1370 /* Reallocate the table. */
1371 int i = print_number_index * 4; 1371 int i = print_number_index * 4;
@@ -1411,7 +1411,7 @@ print_preprocess (obj)
1411 goto loop; 1411 goto loop;
1412 1412
1413 case Lisp_Vectorlike: 1413 case Lisp_Vectorlike:
1414 size = XVECTOR (obj)->size; 1414 size = XVECTOR_SIZE (obj);
1415 if (size & PSEUDOVECTOR_FLAG) 1415 if (size & PSEUDOVECTOR_FLAG)
1416 size &= PSEUDOVECTOR_SIZE_MASK; 1416 size &= PSEUDOVECTOR_SIZE_MASK;
1417 for (i = 0; i < size; i++) 1417 for (i = 0; i < size; i++)
@@ -2051,7 +2051,7 @@ print_object (obj, printcharfun, escapeflag)
2051 strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0); 2051 strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0);
2052 PRINTCHAR (' '); 2052 PRINTCHAR (' ');
2053 sprintf (buf, "%ld/%ld", (long) h->count, 2053 sprintf (buf, "%ld/%ld", (long) h->count,
2054 (long) XVECTOR (h->next)->size); 2054 (long) XVECTOR_SIZE (h->next));
2055 strout (buf, -1, -1, printcharfun, 0); 2055 strout (buf, -1, -1, printcharfun, 0);
2056 } 2056 }
2057 sprintf (buf, " 0x%lx", (unsigned long) h); 2057 sprintf (buf, " 0x%lx", (unsigned long) h);
@@ -2062,7 +2062,7 @@ print_object (obj, printcharfun, escapeflag)
2062 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ 2062 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
2063 /* Always print the size. */ 2063 /* Always print the size. */
2064 sprintf (buf, "#s(hash-table size %ld", 2064 sprintf (buf, "#s(hash-table size %ld",
2065 (long) XVECTOR (h->next)->size); 2065 (long) XVECTOR_SIZE (h->next));
2066 strout (buf, -1, -1, printcharfun, 0); 2066 strout (buf, -1, -1, printcharfun, 0);
2067 2067
2068 if (!NILP (h->test)) 2068 if (!NILP (h->test))
@@ -2174,7 +2174,7 @@ print_object (obj, printcharfun, escapeflag)
2174 } 2174 }
2175 else 2175 else
2176 { 2176 {
2177 EMACS_INT size = XVECTOR (obj)->size; 2177 EMACS_INT size = XVECTOR_SIZE (obj);
2178 if (COMPILEDP (obj)) 2178 if (COMPILEDP (obj))
2179 { 2179 {
2180 PRINTCHAR ('#'); 2180 PRINTCHAR ('#');
@@ -2354,7 +2354,7 @@ print_object (obj, printcharfun, escapeflag)
2354 if (MISCP (obj)) 2354 if (MISCP (obj))
2355 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj)); 2355 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
2356 else if (VECTORLIKEP (obj)) 2356 else if (VECTORLIKEP (obj))
2357 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size); 2357 sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR_SIZE (obj));
2358 else 2358 else
2359 sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); 2359 sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
2360 strout (buf, -1, -1, printcharfun, 0); 2360 strout (buf, -1, -1, printcharfun, 0);
diff --git a/src/process.c b/src/process.c
index 9a33500dc4e..d4371fb8f32 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1277,25 +1277,26 @@ Returns nil if format of ADDRESS is invalid. */)
1277 if (VECTORP (address)) /* AF_INET or AF_INET6 */ 1277 if (VECTORP (address)) /* AF_INET or AF_INET6 */
1278 { 1278 {
1279 register struct Lisp_Vector *p = XVECTOR (address); 1279 register struct Lisp_Vector *p = XVECTOR (address);
1280 EMACS_UINT size = p->header.size;
1280 Lisp_Object args[10]; 1281 Lisp_Object args[10];
1281 int nargs, i; 1282 int nargs, i;
1282 1283
1283 if (p->size == 4 || (p->size == 5 && !NILP (omit_port))) 1284 if (size == 4 || (size == 5 && !NILP (omit_port)))
1284 { 1285 {
1285 args[0] = build_string ("%d.%d.%d.%d"); 1286 args[0] = build_string ("%d.%d.%d.%d");
1286 nargs = 4; 1287 nargs = 4;
1287 } 1288 }
1288 else if (p->size == 5) 1289 else if (size == 5)
1289 { 1290 {
1290 args[0] = build_string ("%d.%d.%d.%d:%d"); 1291 args[0] = build_string ("%d.%d.%d.%d:%d");
1291 nargs = 5; 1292 nargs = 5;
1292 } 1293 }
1293 else if (p->size == 8 || (p->size == 9 && !NILP (omit_port))) 1294 else if (size == 8 || (size == 9 && !NILP (omit_port)))
1294 { 1295 {
1295 args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x"); 1296 args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
1296 nargs = 8; 1297 nargs = 8;
1297 } 1298 }
1298 else if (p->size == 9) 1299 else if (size == 9)
1299 { 1300 {
1300 args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d"); 1301 args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
1301 nargs = 9; 1302 nargs = 9;
@@ -2477,13 +2478,13 @@ get_lisp_to_sockaddr_size (address, familyp)
2477 if (VECTORP (address)) 2478 if (VECTORP (address))
2478 { 2479 {
2479 p = XVECTOR (address); 2480 p = XVECTOR (address);
2480 if (p->size == 5) 2481 if (p->header.size == 5)
2481 { 2482 {
2482 *familyp = AF_INET; 2483 *familyp = AF_INET;
2483 return sizeof (struct sockaddr_in); 2484 return sizeof (struct sockaddr_in);
2484 } 2485 }
2485#ifdef AF_INET6 2486#ifdef AF_INET6
2486 else if (p->size == 9) 2487 else if (p->header.size == 9)
2487 { 2488 {
2488 *familyp = AF_INET6; 2489 *familyp = AF_INET6;
2489 return sizeof (struct sockaddr_in6); 2490 return sizeof (struct sockaddr_in6);
@@ -2502,7 +2503,7 @@ get_lisp_to_sockaddr_size (address, familyp)
2502 struct sockaddr *sa; 2503 struct sockaddr *sa;
2503 *familyp = XINT (XCAR (address)); 2504 *familyp = XINT (XCAR (address));
2504 p = XVECTOR (XCDR (address)); 2505 p = XVECTOR (XCDR (address));
2505 return p->size + sizeof (sa->sa_family); 2506 return p->header.size + sizeof (sa->sa_family);
2506 } 2507 }
2507 return 0; 2508 return 0;
2508} 2509}
diff --git a/src/process.h b/src/process.h
index 72e8af70262..0ff374ee47f 100644
--- a/src/process.h
+++ b/src/process.h
@@ -27,13 +27,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27/* This structure records information about a subprocess 27/* This structure records information about a subprocess
28 or network connection. 28 or network connection.
29 29
30 Every field in this structure except for the first two 30 Every field in this structure except for the header
31 must be a Lisp_Object, for GC's sake. */ 31 must be a Lisp_Object, for GC's sake. */
32 32
33struct Lisp_Process 33struct Lisp_Process
34 { 34 {
35 EMACS_UINT size; 35 struct vectorlike_header header;
36 struct Lisp_Vector *v_next; 36
37 /* Name of subprocess terminal. */ 37 /* Name of subprocess terminal. */
38 Lisp_Object tty_name; 38 Lisp_Object tty_name;
39 /* Name of this process */ 39 /* Name of this process */
diff --git a/src/syntax.c b/src/syntax.c
index 97c67c955b1..bfdf0e5ee6d 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -956,7 +956,7 @@ text property. */)
956 break; 956 break;
957 } 957 }
958 958
959 if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match)) 959 if (val < XVECTOR_SIZE (Vsyntax_code_object) && NILP (match))
960 return XVECTOR (Vsyntax_code_object)->contents[val]; 960 return XVECTOR (Vsyntax_code_object)->contents[val];
961 else 961 else
962 /* Since we can't use a shared object, let's make a new one. */ 962 /* Since we can't use a shared object, let's make a new one. */
@@ -3348,7 +3348,7 @@ init_syntax_once ()
3348 3348
3349 /* Create objects which can be shared among syntax tables. */ 3349 /* Create objects which can be shared among syntax tables. */
3350 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); 3350 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil);
3351 for (i = 0; i < XVECTOR (Vsyntax_code_object)->size; i++) 3351 for (i = 0; i < XVECTOR_SIZE (Vsyntax_code_object); i++)
3352 XVECTOR (Vsyntax_code_object)->contents[i] 3352 XVECTOR (Vsyntax_code_object)->contents[i]
3353 = Fcons (make_number (i), Qnil); 3353 = Fcons (make_number (i), Qnil);
3354 3354
diff --git a/src/termhooks.h b/src/termhooks.h
index f8c26b0a54c..a318087e846 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -325,10 +325,8 @@ struct w32_display_info;
325/* Terminal-local parameters. */ 325/* Terminal-local parameters. */
326struct terminal 326struct terminal
327{ 327{
328 /* The first two fields are really the header of a vector */ 328 /* This is for Lisp; the terminal code does not refer to it. */
329 /* The terminal code does not refer to them. */ 329 struct vectorlike_header header;
330 EMACS_UINT size;
331 struct Lisp_Vector *vec_next;
332 330
333 /* Parameter alist of this terminal. */ 331 /* Parameter alist of this terminal. */
334 Lisp_Object param_alist; 332 Lisp_Object param_alist;
diff --git a/src/w32font.c b/src/w32font.c
index 0f01cebefc0..b467122b5fd 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -173,7 +173,7 @@ intern_font_name (string)
173 173
174 /* The following code is copied from the function intern (in lread.c). */ 174 /* The following code is copied from the function intern (in lread.c). */
175 obarray = Vobarray; 175 obarray = Vobarray;
176 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 176 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
177 obarray = check_obarray (obarray); 177 obarray = check_obarray (obarray);
178 tem = oblookup (obarray, SDATA (str), len, len); 178 tem = oblookup (obarray, SDATA (str), len, len);
179 if (SYMBOLP (tem)) 179 if (SYMBOLP (tem))
diff --git a/src/w32menu.c b/src/w32menu.c
index d85a17e5b85..f29ca9e2ef1 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -464,11 +464,11 @@ set_frame_menubar (f, first_time, deep_p)
464 464
465 menu_items = f->menu_bar_vector; 465 menu_items = f->menu_bar_vector;
466 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 466 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
467 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 467 submenu_start = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
468 submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 468 submenu_end = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
469 submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); 469 submenu_n_panes = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int));
470 submenu_top_level_items 470 submenu_top_level_items
471 = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 471 = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
472 init_menu_items (); 472 init_menu_items ();
473 for (i = 0; i < ASIZE (items); i += 4) 473 for (i = 0; i < ASIZE (items); i += 4)
474 { 474 {
diff --git a/src/window.c b/src/window.c
index 3e6062a7153..894ff65b600 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5931,8 +5931,7 @@ zero means top of window, negative means relative to bottom of window. */)
5931 5931
5932struct save_window_data 5932struct save_window_data
5933 { 5933 {
5934 EMACS_UINT size; 5934 struct vectorlike_header header;
5935 struct Lisp_Vector *next_from_Lisp_Vector_struct;
5936 Lisp_Object selected_frame; 5935 Lisp_Object selected_frame;
5937 Lisp_Object current_window; 5936 Lisp_Object current_window;
5938 Lisp_Object current_buffer; 5937 Lisp_Object current_buffer;
@@ -5954,10 +5953,7 @@ struct save_window_data
5954/* This is saved as a Lisp_Vector */ 5953/* This is saved as a Lisp_Vector */
5955struct saved_window 5954struct saved_window
5956{ 5955{
5957 /* these first two must agree with struct Lisp_Vector in lisp.h */ 5956 struct vectorlike_header header;
5958 EMACS_UINT size;
5959 struct Lisp_Vector *next_from_Lisp_Vector_struct;
5960
5961 Lisp_Object window; 5957 Lisp_Object window;
5962 Lisp_Object buffer, start, pointm, mark; 5958 Lisp_Object buffer, start, pointm, mark;
5963 Lisp_Object left_col, top_line, total_cols, total_lines; 5959 Lisp_Object left_col, top_line, total_cols, total_lines;
@@ -6141,7 +6137,7 @@ the return value is nil. Otherwise the value is t. */)
6141 dead. */ 6137 dead. */
6142 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); 6138 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f)));
6143 6139
6144 for (k = 0; k < saved_windows->size; k++) 6140 for (k = 0; k < saved_windows->header.size; k++)
6145 { 6141 {
6146 p = SAVED_WINDOW_N (saved_windows, k); 6142 p = SAVED_WINDOW_N (saved_windows, k);
6147 w = XWINDOW (p->window); 6143 w = XWINDOW (p->window);
@@ -7078,10 +7074,10 @@ compare_window_configurations (c1, c2, ignore_positions)
7078 return 0; 7074 return 0;
7079 7075
7080 /* Verify that the two confis have the same number of windows. */ 7076 /* Verify that the two confis have the same number of windows. */
7081 if (sw1->size != sw2->size) 7077 if (sw1->header.size != sw2->header.size)
7082 return 0; 7078 return 0;
7083 7079
7084 for (i = 0; i < sw1->size; i++) 7080 for (i = 0; i < sw1->header.size; i++)
7085 { 7081 {
7086 struct saved_window *p1, *p2; 7082 struct saved_window *p1, *p2;
7087 int w1_is_current, w2_is_current; 7083 int w1_is_current, w2_is_current;
diff --git a/src/window.h b/src/window.h
index 99259b7f3a2..f7759467d0d 100644
--- a/src/window.h
+++ b/src/window.h
@@ -89,10 +89,9 @@ struct cursor_pos
89 89
90struct window 90struct window
91 { 91 {
92 /* The first two fields are really the header of a vector */ 92 /* This is for Lisp; the terminal code does not refer to it. */
93 /* The window code does not refer to them. */ 93 struct vectorlike_header header;
94 EMACS_UINT size; 94
95 struct Lisp_Vector *vec_next;
96 /* The frame this window is on. */ 95 /* The frame this window is on. */
97 Lisp_Object frame; 96 Lisp_Object frame;
98 /* t if this window is a minibuffer window. */ 97 /* t if this window is a minibuffer window. */
diff --git a/src/xdisp.c b/src/xdisp.c
index c42410b9f9f..1f4c829ce94 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3865,7 +3865,7 @@ setup_for_ellipsis (it, len)
3865 { 3865 {
3866 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); 3866 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
3867 it->dpvec = v->contents; 3867 it->dpvec = v->contents;
3868 it->dpend = v->contents + v->size; 3868 it->dpend = v->contents + v->header.size;
3869 } 3869 }
3870 else 3870 else
3871 { 3871 {
@@ -5697,11 +5697,11 @@ get_next_display_element (it)
5697 /* Return the first character from the display table 5697 /* Return the first character from the display table
5698 entry, if not empty. If empty, don't display the 5698 entry, if not empty. If empty, don't display the
5699 current character. */ 5699 current character. */
5700 if (v->size) 5700 if (v->header.size)
5701 { 5701 {
5702 it->dpvec_char_len = it->len; 5702 it->dpvec_char_len = it->len;
5703 it->dpvec = v->contents; 5703 it->dpvec = v->contents;
5704 it->dpend = v->contents + v->size; 5704 it->dpend = v->contents + v->header.size;
5705 it->current.dpvec_index = 0; 5705 it->current.dpvec_index = 0;
5706 it->dpvec_face_id = -1; 5706 it->dpvec_face_id = -1;
5707 it->saved_face_id = it->face_id; 5707 it->saved_face_id = it->face_id;
@@ -17087,7 +17087,7 @@ display_menu_bar (w)
17087 17087
17088 /* Display all items of the menu bar. */ 17088 /* Display all items of the menu bar. */
17089 items = FRAME_MENU_BAR_ITEMS (it.f); 17089 items = FRAME_MENU_BAR_ITEMS (it.f);
17090 for (i = 0; i < XVECTOR (items)->size; i += 4) 17090 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
17091 { 17091 {
17092 Lisp_Object string; 17092 Lisp_Object string;
17093 17093
@@ -23086,7 +23086,7 @@ on_hot_spot_p (hot_spot, x, y)
23086 { 23086 {
23087 struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); 23087 struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
23088 Lisp_Object *poly = v->contents; 23088 Lisp_Object *poly = v->contents;
23089 int n = v->size; 23089 int n = v->header.size;
23090 int i; 23090 int i;
23091 int inside = 0; 23091 int inside = 0;
23092 Lisp_Object lx, ly; 23092 Lisp_Object lx, ly;
diff --git a/src/xfaces.c b/src/xfaces.c
index 9956ef55842..1606113596d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1966,7 +1966,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1966 1966
1967#define LFACEP(LFACE) \ 1967#define LFACEP(LFACE) \
1968 (VECTORP (LFACE) \ 1968 (VECTORP (LFACE) \
1969 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ 1969 && XVECTOR_SIZE (LFACE) == LFACE_VECTOR_SIZE \
1970 && EQ (AREF (LFACE, 0), Qface)) 1970 && EQ (AREF (LFACE, 0), Qface))
1971 1971
1972 1972
diff --git a/src/xmenu.c b/src/xmenu.c
index c2e70e13bf9..2a05c52ee34 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1012,6 +1012,7 @@ set_frame_menubar (f, first_time, deep_p)
1012 Lisp_Object *previous_items 1012 Lisp_Object *previous_items
1013 = (Lisp_Object *) alloca (previous_menu_items_used 1013 = (Lisp_Object *) alloca (previous_menu_items_used
1014 * sizeof (Lisp_Object)); 1014 * sizeof (Lisp_Object));
1015 EMACS_UINT subitems;
1015 1016
1016 /* If we are making a new widget, its contents are empty, 1017 /* If we are making a new widget, its contents are empty,
1017 do always reinitialize them. */ 1018 do always reinitialize them. */
@@ -1056,13 +1057,14 @@ set_frame_menubar (f, first_time, deep_p)
1056 1057
1057 menu_items = f->menu_bar_vector; 1058 menu_items = f->menu_bar_vector;
1058 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 1059 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
1059 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 1060 subitems = XVECTOR_SIZE (items) / 4;
1060 submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 1061 submenu_start = (int *) alloca (subitems * sizeof (int *));
1061 submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); 1062 submenu_end = (int *) alloca (subitems * sizeof (int *));
1063 submenu_n_panes = (int *) alloca (subitems * sizeof (int));
1062 submenu_top_level_items 1064 submenu_top_level_items
1063 = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 1065 = (int *) alloca (subitems * sizeof (int *));
1064 init_menu_items (); 1066 init_menu_items ();
1065 for (i = 0; i < XVECTOR (items)->size; i += 4) 1067 for (i = 0; i < subitems; i += 4)
1066 { 1068 {
1067 Lisp_Object key, string, maps; 1069 Lisp_Object key, string, maps;
1068 1070
@@ -1142,7 +1144,7 @@ set_frame_menubar (f, first_time, deep_p)
1142 /* Now GC cannot happen during the lifetime of the widget_value, 1144 /* Now GC cannot happen during the lifetime of the widget_value,
1143 so it's safe to store data from a Lisp_String. */ 1145 so it's safe to store data from a Lisp_String. */
1144 wv = first_wv->contents; 1146 wv = first_wv->contents;
1145 for (i = 0; i < XVECTOR (items)->size; i += 4) 1147 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
1146 { 1148 {
1147 Lisp_Object string; 1149 Lisp_Object string;
1148 string = XVECTOR (items)->contents[i + 1]; 1150 string = XVECTOR (items)->contents[i + 1];
@@ -1168,7 +1170,7 @@ set_frame_menubar (f, first_time, deep_p)
1168 first_wv = wv; 1170 first_wv = wv;
1169 1171
1170 items = FRAME_MENU_BAR_ITEMS (f); 1172 items = FRAME_MENU_BAR_ITEMS (f);
1171 for (i = 0; i < XVECTOR (items)->size; i += 4) 1173 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
1172 { 1174 {
1173 Lisp_Object string; 1175 Lisp_Object string;
1174 1176
diff --git a/src/xselect.c b/src/xselect.c
index 023d2eee8c3..00099ec6f0c 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -486,7 +486,7 @@ x_get_local_selection (selection_symbol, target_type, local_request)
486 int size; 486 int size;
487 int i; 487 int i;
488 pairs = XCDR (target_type); 488 pairs = XCDR (target_type);
489 size = XVECTOR (pairs)->size; 489 size = XVECTOR_SIZE (pairs);
490 /* If the target is MULTIPLE, then target_type looks like 490 /* If the target is MULTIPLE, then target_type looks like
491 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ]) 491 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ])
492 We modify the second element of each pair in the vector and 492 We modify the second element of each pair in the vector and
@@ -1351,12 +1351,12 @@ copy_multiple_data (obj)
1351 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj))); 1351 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
1352 1352
1353 CHECK_VECTOR (obj); 1353 CHECK_VECTOR (obj);
1354 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); 1354 vec = Fmake_vector (size = XVECTOR_SIZE (obj), Qnil);
1355 for (i = 0; i < size; i++) 1355 for (i = 0; i < size; i++)
1356 { 1356 {
1357 Lisp_Object vec2 = XVECTOR (obj)->contents [i]; 1357 Lisp_Object vec2 = XVECTOR (obj)->contents [i];
1358 CHECK_VECTOR (vec2); 1358 CHECK_VECTOR (vec2);
1359 if (XVECTOR (vec2)->size != 2) 1359 if (XVECTOR_SIZE (vec2) != 2)
1360 /* ??? Confusing error message */ 1360 /* ??? Confusing error message */
1361 signal_error ("Vectors must be of length 2", vec2); 1361 signal_error ("Vectors must be of length 2", vec2);
1362 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil); 1362 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil);
@@ -1996,7 +1996,7 @@ lisp_data_to_selection_data (display, obj,
1996 /* This vector is an ATOM set */ 1996 /* This vector is an ATOM set */
1997 { 1997 {
1998 if (NILP (type)) type = QATOM; 1998 if (NILP (type)) type = QATOM;
1999 *size_ret = XVECTOR (obj)->size; 1999 *size_ret = XVECTOR_SIZE (obj);
2000 *format_ret = 32; 2000 *format_ret = 32;
2001 *data_ret = (unsigned char *) xmalloc ((*size_ret) * sizeof (Atom)); 2001 *data_ret = (unsigned char *) xmalloc ((*size_ret) * sizeof (Atom));
2002 for (i = 0; i < *size_ret; i++) 2002 for (i = 0; i < *size_ret; i++)
@@ -2011,7 +2011,7 @@ lisp_data_to_selection_data (display, obj,
2011 /* This vector is an ATOM_PAIR set */ 2011 /* This vector is an ATOM_PAIR set */
2012 { 2012 {
2013 if (NILP (type)) type = QATOM_PAIR; 2013 if (NILP (type)) type = QATOM_PAIR;
2014 *size_ret = XVECTOR (obj)->size; 2014 *size_ret = XVECTOR_SIZE (obj);
2015 *format_ret = 32; 2015 *format_ret = 32;
2016 *data_ret = (unsigned char *) 2016 *data_ret = (unsigned char *)
2017 xmalloc ((*size_ret) * sizeof (Atom) * 2); 2017 xmalloc ((*size_ret) * sizeof (Atom) * 2);
@@ -2019,7 +2019,7 @@ lisp_data_to_selection_data (display, obj,
2019 if (VECTORP (XVECTOR (obj)->contents [i])) 2019 if (VECTORP (XVECTOR (obj)->contents [i]))
2020 { 2020 {
2021 Lisp_Object pair = XVECTOR (obj)->contents [i]; 2021 Lisp_Object pair = XVECTOR (obj)->contents [i];
2022 if (XVECTOR (pair)->size != 2) 2022 if (XVECTOR_SIZE (pair) != 2)
2023 signal_error ( 2023 signal_error (
2024 "Elements of the vector must be vectors of exactly two elements", 2024 "Elements of the vector must be vectors of exactly two elements",
2025 pair); 2025 pair);
@@ -2041,7 +2041,7 @@ lisp_data_to_selection_data (display, obj,
2041 /* This vector is an INTEGER set, or something like it */ 2041 /* This vector is an INTEGER set, or something like it */
2042 { 2042 {
2043 int data_size = 2; 2043 int data_size = 2;
2044 *size_ret = XVECTOR (obj)->size; 2044 *size_ret = XVECTOR_SIZE (obj);
2045 if (NILP (type)) type = QINTEGER; 2045 if (NILP (type)) type = QINTEGER;
2046 *format_ret = 16; 2046 *format_ret = 16;
2047 for (i = 0; i < *size_ret; i++) 2047 for (i = 0; i < *size_ret; i++)
@@ -2095,7 +2095,7 @@ clean_local_selection_data (obj)
2095 if (VECTORP (obj)) 2095 if (VECTORP (obj))
2096 { 2096 {
2097 int i; 2097 int i;
2098 int size = XVECTOR (obj)->size; 2098 int size = XVECTOR_SIZE (obj);
2099 Lisp_Object copy; 2099 Lisp_Object copy;
2100 if (size == 1) 2100 if (size == 1)
2101 return clean_local_selection_data (XVECTOR (obj)->contents [0]); 2101 return clean_local_selection_data (XVECTOR (obj)->contents [0]);