aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-25 00:14:46 -0700
committerPaul Eggert2011-04-25 00:14:46 -0700
commiteab3844f965646b62e242aa622754b86d1fd3444 (patch)
tree10246105e5facc5d61ccf797dfa05debdb1877c1 /src
parent0df1eac54fdf82a80a7611fe421d94a23ebd4a0a (diff)
downloademacs-eab3844f965646b62e242aa622754b86d1fd3444.tar.gz
emacs-eab3844f965646b62e242aa622754b86d1fd3444.zip
lisp.h: 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. * 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. (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. * 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". * buffer.h (struct buffer): Likewise. * font.h (struct font_spec, struct font_entity, struct font): Likewise. * frame.h (struct frame): Likewise. * process.h (struct Lisp_Process): Likewise. * termhooks.h (struct terminal): Likewise. * window.c (struct save_window_data, struct saved_window): Likewise. * window.h (struct window): Likewise. * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector): Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems. * buffer.c (init_buffer_once): Likewise. * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a special case. * process.c (Fformat_network_address): Use local var for size, for brevity.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog55
-rw-r--r--src/alloc.c63
-rw-r--r--src/buffer.c18
-rw-r--r--src/buffer.h7
-rw-r--r--src/bytecode.c2
-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.h3
-rw-r--r--src/doc.c2
-rw-r--r--src/fns.c10
-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.c38
-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.c10
-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.c3
-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.c6
-rw-r--r--src/xselect.c16
40 files changed, 274 insertions, 210 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e6a9f9c69fb..e1548e9a094 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,58 @@
12011-04-25 Paul Eggert <eggert@cs.ucla.edu>
2
3 lisp.h: Fix a problem with aliasing and vector headers.
4 GCC 4.6.0 optimizes based on type-based alias analysis. For
5 example, if b is of type struct buffer * and v of type struct
6 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
7 != &v->size, and therefore "v->size = 1; b->size = 2; return
8 v->size;" must therefore return 1. This assumption is incorrect
9 for Emacs, since it type-puns struct Lisp_Vector * with many other
10 types. To fix this problem, this patch adds a new type struct
11 vector_header that documents the constraints on layout of vectors
12 and pseudovectors, and helps optimizing compilers not get fooled
13 by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE
14 XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
15 * lisp.h (XVECTOR_SIZE): New convenience macro. All previous uses of
16 XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
17 of writing XVECTOR (foo)->header.size.
18 (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
19 (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
20 member.
21 (XSETPVECTYPE): Rewrite in terms of new macro.
22 (XSETPVECTYPESIZE): New macro, specifying both type and size.
23 This is a bit clearer, and further avoids the possibility of
24 undesirable aliasing.
25 (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
26 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
27 and XVECTOR_HEADER_SIZE.
28 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
29 since Lisp_Subr is a special case (no "next" field).
30 (ASIZE): Rewrite in terms of XVECTOR_SIZE.
31 (struct vector_header): New type.
32 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
33 object, to help avoid aliasing.
34 (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
35 (SUBRP): Likewise, since Lisp_Subr is a special case.
36 * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
37 (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
38 (struct Lisp_Hash_Table): Combine first two members into a single
39 struct vector_header member. All uses of "size" and "next" members
40 changed to be "header.size" and "header.next".
41 * buffer.h (struct buffer): Likewise.
42 * font.h (struct font_spec, struct font_entity, struct font): Likewise.
43 * frame.h (struct frame): Likewise.
44 * process.h (struct Lisp_Process): Likewise.
45 * termhooks.h (struct terminal): Likewise.
46 * window.c (struct save_window_data, struct saved_window): Likewise.
47 * window.h (struct window): Likewise.
48 * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
49 Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
50 * buffer.c (init_buffer_once): Likewise.
51 * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
52 special case.
53 * process.c (Fformat_network_address): Use local var for size,
54 for brevity.
55
12011-04-24 Paul Eggert <eggert@cs.ucla.edu> 562011-04-24 Paul Eggert <eggert@cs.ucla.edu>
2 57
3 * bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR. 58 * bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
diff --git a/src/alloc.c b/src/alloc.c
index dd27303428f..c9496ecf25c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -146,9 +146,9 @@ static pthread_mutex_t alloc_mutex;
146#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG) 146#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG)
147#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0) 147#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0)
148 148
149#define VECTOR_MARK(V) ((V)->size |= ARRAY_MARK_FLAG) 149#define VECTOR_MARK(V) ((V)->header.size |= ARRAY_MARK_FLAG)
150#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) 150#define VECTOR_UNMARK(V) ((V)->header.size &= ~ARRAY_MARK_FLAG)
151#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0) 151#define VECTOR_MARKED_P(V) (((V)->header.size & ARRAY_MARK_FLAG) != 0)
152 152
153/* Value is the number of bytes of S, a pointer to a struct Lisp_String. 153/* Value is the number of bytes of S, a pointer to a struct Lisp_String.
154 Be careful during GC, because S->size contains the mark bit for 154 Be careful during GC, because S->size contains the mark bit for
@@ -1055,9 +1055,9 @@ allocate_buffer (void)
1055 struct buffer *b 1055 struct buffer *b
1056 = (struct buffer *) lisp_malloc (sizeof (struct buffer), 1056 = (struct buffer *) lisp_malloc (sizeof (struct buffer),
1057 MEM_TYPE_BUFFER); 1057 MEM_TYPE_BUFFER);
1058 b->size = ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1) 1058 XSETPVECTYPESIZE (b, PVEC_BUFFER,
1059 / sizeof (EMACS_INT)); 1059 ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1)
1060 XSETPVECTYPE (b, PVEC_BUFFER); 1060 / sizeof (EMACS_INT)));
1061 return b; 1061 return b;
1062} 1062}
1063 1063
@@ -2244,10 +2244,8 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
2244 slot `size' of the struct Lisp_Bool_Vector. */ 2244 slot `size' of the struct Lisp_Bool_Vector. */
2245 val = Fmake_vector (make_number (length_in_elts + 1), Qnil); 2245 val = Fmake_vector (make_number (length_in_elts + 1), Qnil);
2246 2246
2247 /* Get rid of any bits that would cause confusion. */ 2247 /* No Lisp_Object to trace in there. */
2248 XVECTOR (val)->size = 0; /* No Lisp_Object to trace in there. */ 2248 XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0);
2249 /* Use XVECTOR (val) rather than `p' because p->size is not TRT. */
2250 XSETPVECTYPE (XVECTOR (val), PVEC_BOOL_VECTOR);
2251 2249
2252 p = XBOOL_VECTOR (val); 2250 p = XBOOL_VECTOR (val);
2253 p->size = XFASTINT (length); 2251 p->size = XFASTINT (length);
@@ -2814,7 +2812,7 @@ allocate_vectorlike (EMACS_INT len)
2814 consing_since_gc += nbytes; 2812 consing_since_gc += nbytes;
2815 vector_cells_consed += len; 2813 vector_cells_consed += len;
2816 2814
2817 p->next = all_vectors; 2815 p->header.next.vector = all_vectors;
2818 all_vectors = p; 2816 all_vectors = p;
2819 2817
2820 MALLOC_UNBLOCK_INPUT; 2818 MALLOC_UNBLOCK_INPUT;
@@ -2830,7 +2828,7 @@ struct Lisp_Vector *
2830allocate_vector (EMACS_INT nslots) 2828allocate_vector (EMACS_INT nslots)
2831{ 2829{
2832 struct Lisp_Vector *v = allocate_vectorlike (nslots); 2830 struct Lisp_Vector *v = allocate_vectorlike (nslots);
2833 v->size = nslots; 2831 v->header.size = nslots;
2834 return v; 2832 return v;
2835} 2833}
2836 2834
@@ -2844,11 +2842,10 @@ allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag)
2844 EMACS_INT i; 2842 EMACS_INT i;
2845 2843
2846 /* Only the first lisplen slots will be traced normally by the GC. */ 2844 /* Only the first lisplen slots will be traced normally by the GC. */
2847 v->size = lisplen;
2848 for (i = 0; i < lisplen; ++i) 2845 for (i = 0; i < lisplen; ++i)
2849 v->contents[i] = Qnil; 2846 v->contents[i] = Qnil;
2850 2847
2851 XSETPVECTYPE (v, tag); /* Add the appropriate tag. */ 2848 XSETPVECTYPESIZE (v, tag, lisplen);
2852 return v; 2849 return v;
2853} 2850}
2854 2851
@@ -4737,7 +4734,7 @@ make_pure_vector (EMACS_INT len)
4737 4734
4738 p = (struct Lisp_Vector *) pure_alloc (size, Lisp_Vectorlike); 4735 p = (struct Lisp_Vector *) pure_alloc (size, Lisp_Vectorlike);
4739 XSETVECTOR (new, p); 4736 XSETVECTOR (new, p);
4740 XVECTOR (new)->size = len; 4737 XVECTOR (new)->header.size = len;
4741 return new; 4738 return new;
4742} 4739}
4743 4740
@@ -4775,7 +4772,7 @@ Does not copy symbols. Copies strings without text properties. */)
4775 register EMACS_INT i; 4772 register EMACS_INT i;
4776 EMACS_INT size; 4773 EMACS_INT size;
4777 4774
4778 size = XVECTOR (obj)->size; 4775 size = XVECTOR_SIZE (obj);
4779 if (size & PSEUDOVECTOR_FLAG) 4776 if (size & PSEUDOVECTOR_FLAG)
4780 size &= PSEUDOVECTOR_SIZE_MASK; 4777 size &= PSEUDOVECTOR_SIZE_MASK;
4781 vec = XVECTOR (make_pure_vector (size)); 4778 vec = XVECTOR (make_pure_vector (size));
@@ -4899,7 +4896,7 @@ returns nil, because real GC can't be done. */)
4899 } 4896 }
4900 } 4897 }
4901 4898
4902 nextb = nextb->next; 4899 nextb = nextb->header.next.buffer;
4903 } 4900 }
4904 } 4901 }
4905 4902
@@ -5054,7 +5051,7 @@ returns nil, because real GC can't be done. */)
5054 undo_list any more, we can finally mark the list. */ 5051 undo_list any more, we can finally mark the list. */
5055 mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list)); 5052 mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list));
5056 5053
5057 nextb = nextb->next; 5054 nextb = nextb->header.next.buffer;
5058 } 5055 }
5059 } 5056 }
5060 5057
@@ -5228,7 +5225,7 @@ static size_t mark_object_loop_halt;
5228static void 5225static void
5229mark_vectorlike (struct Lisp_Vector *ptr) 5226mark_vectorlike (struct Lisp_Vector *ptr)
5230{ 5227{
5231 register EMACS_UINT size = ptr->size; 5228 register EMACS_UINT size = ptr->header.size;
5232 register EMACS_UINT i; 5229 register EMACS_UINT i;
5233 5230
5234 eassert (!VECTOR_MARKED_P (ptr)); 5231 eassert (!VECTOR_MARKED_P (ptr));
@@ -5251,7 +5248,7 @@ mark_vectorlike (struct Lisp_Vector *ptr)
5251static void 5248static void
5252mark_char_table (struct Lisp_Vector *ptr) 5249mark_char_table (struct Lisp_Vector *ptr)
5253{ 5250{
5254 register EMACS_UINT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; 5251 register EMACS_UINT size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
5255 register EMACS_UINT i; 5252 register EMACS_UINT i;
5256 5253
5257 eassert (!VECTOR_MARKED_P (ptr)); 5254 eassert (!VECTOR_MARKED_P (ptr));
@@ -5364,7 +5361,7 @@ mark_object (Lisp_Object arg)
5364 if (po != &buffer_defaults && po != &buffer_local_symbols) 5361 if (po != &buffer_defaults && po != &buffer_local_symbols)
5365 { 5362 {
5366 struct buffer *b; 5363 struct buffer *b;
5367 for (b = all_buffers; b && b != po; b = b->next) 5364 for (b = all_buffers; b && b != po; b = b->header.next)
5368 ; 5365 ;
5369 if (b == NULL) 5366 if (b == NULL)
5370 abort (); 5367 abort ();
@@ -5380,7 +5377,7 @@ mark_object (Lisp_Object arg)
5380 recursion there. */ 5377 recursion there. */
5381 { 5378 {
5382 register struct Lisp_Vector *ptr = XVECTOR (obj); 5379 register struct Lisp_Vector *ptr = XVECTOR (obj);
5383 register EMACS_UINT size = ptr->size; 5380 register EMACS_UINT size = ptr->header.size;
5384 register EMACS_UINT i; 5381 register EMACS_UINT i;
5385 5382
5386 CHECK_LIVE (live_vector_p); 5383 CHECK_LIVE (live_vector_p);
@@ -6012,10 +6009,10 @@ gc_sweep (void)
6012 if (!VECTOR_MARKED_P (buffer)) 6009 if (!VECTOR_MARKED_P (buffer))
6013 { 6010 {
6014 if (prev) 6011 if (prev)
6015 prev->next = buffer->next; 6012 prev->header.next = buffer->header.next;
6016 else 6013 else
6017 all_buffers = buffer->next; 6014 all_buffers = buffer->header.next.buffer;
6018 next = buffer->next; 6015 next = buffer->header.next.buffer;
6019 lisp_free (buffer); 6016 lisp_free (buffer);
6020 buffer = next; 6017 buffer = next;
6021 } 6018 }
@@ -6023,7 +6020,7 @@ gc_sweep (void)
6023 { 6020 {
6024 VECTOR_UNMARK (buffer); 6021 VECTOR_UNMARK (buffer);
6025 UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer)); 6022 UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer));
6026 prev = buffer, buffer = buffer->next; 6023 prev = buffer, buffer = buffer->header.next.buffer;
6027 } 6024 }
6028 } 6025 }
6029 6026
@@ -6036,10 +6033,10 @@ gc_sweep (void)
6036 if (!VECTOR_MARKED_P (vector)) 6033 if (!VECTOR_MARKED_P (vector))
6037 { 6034 {
6038 if (prev) 6035 if (prev)
6039 prev->next = vector->next; 6036 prev->header.next = vector->header.next;
6040 else 6037 else
6041 all_vectors = vector->next; 6038 all_vectors = vector->header.next.vector;
6042 next = vector->next; 6039 next = vector->header.next.vector;
6043 lisp_free (vector); 6040 lisp_free (vector);
6044 n_vectors--; 6041 n_vectors--;
6045 vector = next; 6042 vector = next;
@@ -6048,11 +6045,11 @@ gc_sweep (void)
6048 else 6045 else
6049 { 6046 {
6050 VECTOR_UNMARK (vector); 6047 VECTOR_UNMARK (vector);
6051 if (vector->size & PSEUDOVECTOR_FLAG) 6048 if (vector->header.size & PSEUDOVECTOR_FLAG)
6052 total_vector_size += (PSEUDOVECTOR_SIZE_MASK & vector->size); 6049 total_vector_size += PSEUDOVECTOR_SIZE_MASK & vector->header.size;
6053 else 6050 else
6054 total_vector_size += vector->size; 6051 total_vector_size += vector->header.size;
6055 prev = vector, vector = vector->next; 6052 prev = vector, vector = vector->header.next.vector;
6056 } 6053 }
6057 } 6054 }
6058 6055
diff --git a/src/buffer.c b/src/buffer.c
index c649836adb8..6ced4fbae87 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -43,7 +43,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43struct buffer *current_buffer; /* the current buffer */ 43struct buffer *current_buffer; /* the current buffer */
44 44
45/* First buffer in chain of all buffers (in reverse order of creation). 45/* First buffer in chain of all buffers (in reverse order of creation).
46 Threaded through ->next. */ 46 Threaded through ->header.next. */
47 47
48struct buffer *all_buffers; 48struct buffer *all_buffers;
49 49
@@ -359,7 +359,7 @@ even if it is dead. The return value is never nil. */)
359 b->prevent_redisplay_optimizations_p = 1; 359 b->prevent_redisplay_optimizations_p = 1;
360 360
361 /* Put this on the chain of all buffers including killed ones. */ 361 /* Put this on the chain of all buffers including killed ones. */
362 b->next = all_buffers; 362 b->header.next.buffer = all_buffers;
363 all_buffers = b; 363 all_buffers = b;
364 364
365 /* An ordinary buffer normally doesn't need markers 365 /* An ordinary buffer normally doesn't need markers
@@ -588,7 +588,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
588 BVAR (b, width_table) = Qnil; 588 BVAR (b, width_table) = Qnil;
589 589
590 /* Put this on the chain of all buffers including killed ones. */ 590 /* Put this on the chain of all buffers including killed ones. */
591 b->next = all_buffers; 591 b->header.next.buffer = all_buffers;
592 all_buffers = b; 592 all_buffers = b;
593 593
594 name = Fcopy_sequence (name); 594 name = Fcopy_sequence (name);
@@ -1458,7 +1458,7 @@ with SIGHUP. */)
1458 1458
1459 GCPRO1 (buffer); 1459 GCPRO1 (buffer);
1460 1460
1461 for (other = all_buffers; other; other = other->next) 1461 for (other = all_buffers; other; other = other->header.next.buffer)
1462 /* all_buffers contains dead buffers too; 1462 /* all_buffers contains dead buffers too;
1463 don't re-kill them. */ 1463 don't re-kill them. */
1464 if (other->base_buffer == b && !NILP (BVAR (other, name))) 1464 if (other->base_buffer == b && !NILP (BVAR (other, name)))
@@ -2099,7 +2099,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2099 2099
2100 { /* This is probably harder to make work. */ 2100 { /* This is probably harder to make work. */
2101 struct buffer *other; 2101 struct buffer *other;
2102 for (other = all_buffers; other; other = other->next) 2102 for (other = all_buffers; other; other = other->header.next.buffer)
2103 if (other->base_buffer == other_buffer 2103 if (other->base_buffer == other_buffer
2104 || other->base_buffer == current_buffer) 2104 || other->base_buffer == current_buffer)
2105 error ("One of the buffers to swap has indirect buffers"); 2105 error ("One of the buffers to swap has indirect buffers");
@@ -2476,7 +2476,7 @@ current buffer is cleared. */)
2476 2476
2477 /* Copy this buffer's new multibyte status 2477 /* Copy this buffer's new multibyte status
2478 into all of its indirect buffers. */ 2478 into all of its indirect buffers. */
2479 for (other = all_buffers; other; other = other->next) 2479 for (other = all_buffers; other; other = other->header.next.buffer)
2480 if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) 2480 if (other->base_buffer == current_buffer && !NILP (BVAR (other, name)))
2481 { 2481 {
2482 BVAR (other, enable_multibyte_characters) 2482 BVAR (other, enable_multibyte_characters)
@@ -4178,7 +4178,7 @@ static int last_overlay_modification_hooks_used;
4178static void 4178static void
4179add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) 4179add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
4180{ 4180{
4181 int oldsize = XVECTOR (last_overlay_modification_hooks)->size; 4181 int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks);
4182 4182
4183 if (last_overlay_modification_hooks_used == oldsize) 4183 if (last_overlay_modification_hooks_used == oldsize)
4184 last_overlay_modification_hooks = larger_vector 4184 last_overlay_modification_hooks = larger_vector
@@ -4973,9 +4973,9 @@ init_buffer_once (void)
4973 buffer_local_symbols.text = &buffer_local_symbols.own_text; 4973 buffer_local_symbols.text = &buffer_local_symbols.own_text;
4974 BUF_INTERVALS (&buffer_defaults) = 0; 4974 BUF_INTERVALS (&buffer_defaults) = 0;
4975 BUF_INTERVALS (&buffer_local_symbols) = 0; 4975 BUF_INTERVALS (&buffer_local_symbols) = 0;
4976 XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER); 4976 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0);
4977 XSETBUFFER (Vbuffer_defaults, &buffer_defaults); 4977 XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
4978 XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER); 4978 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0);
4979 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); 4979 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
4980 4980
4981 /* Set up the default values of various buffer slots. */ 4981 /* Set up the default values of various buffer slots. */
diff --git a/src/buffer.h b/src/buffer.h
index 2963aa382ca..51b318218cc 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -499,14 +499,13 @@ struct buffer
499 499
500 Check out mark_buffer (alloc.c) to see why. */ 500 Check out mark_buffer (alloc.c) to see why. */
501 501
502 EMACS_UINT size; 502 /* HEADER.NEXT is the next buffer, in chain of all buffers,
503 503 including killed buffers.
504 /* Next buffer, in chain of all buffers including killed buffers.
505 This chain is used only for garbage collection, in order to 504 This chain is used only for garbage collection, in order to
506 collect killed buffers properly. 505 collect killed buffers properly.
507 Note that vectors and most pseudovectors are all on one chain, 506 Note that vectors and most pseudovectors are all on one chain,
508 but buffers are on a separate chain of their own. */ 507 but buffers are on a separate chain of their own. */
509 struct buffer *next; 508 struct vector_header header;
510 509
511 /* This structure holds the coordinates of the buffer contents 510 /* This structure holds the coordinates of the buffer contents
512 in ordinary buffers. In indirect buffers, this is not used. */ 511 in ordinary buffers. In indirect buffers, this is not used. */
diff --git a/src/bytecode.c b/src/bytecode.c
index 3bbd8831633..839e0f7d54e 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -467,7 +467,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
467 CHECK_NUMBER (maxdepth); 467 CHECK_NUMBER (maxdepth);
468 468
469#ifdef BYTE_CODE_SAFE 469#ifdef BYTE_CODE_SAFE
470 const_length = XVECTOR (vector)->size; 470 const_length = XVECTOR_SIZE (vector);
471#endif 471#endif
472 472
473 if (STRING_MULTIBYTE (bytestr)) 473 if (STRING_MULTIBYTE (bytestr))
diff --git a/src/callint.c b/src/callint.c
index e5ec3d7d931..95b193ad91a 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -293,7 +293,7 @@ invoke it. If KEYS is omitted or nil, the return value of
293 else 293 else
294 { 294 {
295 CHECK_VECTOR (keys); 295 CHECK_VECTOR (keys);
296 key_count = XVECTOR (keys)->size; 296 key_count = XVECTOR_SIZE (keys);
297 } 297 }
298 298
299 /* Save this now, since use of minibuffer will clobber it. */ 299 /* Save this now, since use of minibuffer will clobber it. */
diff --git a/src/ccl.c b/src/ccl.c
index 66e0f2c6169..83afd7bc800 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1903,7 +1903,7 @@ setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
1903 if (! VECTORP (ccl_prog)) 1903 if (! VECTORP (ccl_prog))
1904 return -1; 1904 return -1;
1905 vp = XVECTOR (ccl_prog); 1905 vp = XVECTOR (ccl_prog);
1906 ccl->size = vp->size; 1906 ccl->size = vp->header.size;
1907 ccl->prog = vp->contents; 1907 ccl->prog = vp->contents;
1908 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]); 1908 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
1909 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]); 1909 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]);
diff --git a/src/character.c b/src/character.c
index 84eddeb2fc2..8afe02b4700 100644
--- a/src/character.c
+++ b/src/character.c
@@ -357,7 +357,7 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision,
357 { 357 {
358 val = DISP_CHAR_VECTOR (dp, c); 358 val = DISP_CHAR_VECTOR (dp, c);
359 if (VECTORP (val)) 359 if (VECTORP (val))
360 thiswidth = XVECTOR (val)->size; 360 thiswidth = XVECTOR_SIZE (val);
361 else 361 else
362 thiswidth = CHAR_WIDTH (c); 362 thiswidth = CHAR_WIDTH (c);
363 } 363 }
@@ -446,7 +446,7 @@ lisp_string_width (Lisp_Object string, int precision,
446 { 446 {
447 val = DISP_CHAR_VECTOR (dp, c); 447 val = DISP_CHAR_VECTOR (dp, c);
448 if (VECTORP (val)) 448 if (VECTORP (val))
449 thiswidth = XVECTOR (val)->size; 449 thiswidth = XVECTOR_SIZE (val);
450 else 450 else
451 thiswidth = CHAR_WIDTH (c); 451 thiswidth = CHAR_WIDTH (c);
452 } 452 }
diff --git a/src/chartab.c b/src/chartab.c
index eb72d973c87..2f40ceee6ce 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -146,7 +146,7 @@ Lisp_Object
146copy_char_table (Lisp_Object table) 146copy_char_table (Lisp_Object table)
147{ 147{
148 Lisp_Object copy; 148 Lisp_Object copy;
149 int size = XCHAR_TABLE (table)->size & PSEUDOVECTOR_SIZE_MASK; 149 int size = XCHAR_TABLE (table)->header.size & PSEUDOVECTOR_SIZE_MASK;
150 int i; 150 int i;
151 151
152 copy = Fmake_vector (make_number (size), Qnil); 152 copy = Fmake_vector (make_number (size), Qnil);
diff --git a/src/coding.c b/src/coding.c
index 38e41e7a99e..efe4a7c34a1 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7125,7 +7125,7 @@ handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
7125 components = COMPOSITION_COMPONENTS (prop); 7125 components = COMPOSITION_COMPONENTS (prop);
7126 if (VECTORP (components)) 7126 if (VECTORP (components))
7127 { 7127 {
7128 len = XVECTOR (components)->size; 7128 len = XVECTOR_SIZE (components);
7129 for (i = 0; i < len; i++) 7129 for (i = 0; i < len; i++)
7130 *buf++ = XINT (AREF (components, i)); 7130 *buf++ = XINT (AREF (components, i));
7131 } 7131 }
diff --git a/src/composite.c b/src/composite.c
index fab7cb86ba8..aa6090084a0 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -293,7 +293,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
293 } 293 }
294 else if (VECTORP (components) || CONSP (components)) 294 else if (VECTORP (components) || CONSP (components))
295 { 295 {
296 EMACS_UINT len = XVECTOR (key)->size; 296 EMACS_UINT len = XVECTOR_SIZE (key);
297 297
298 /* The number of elements should be odd. */ 298 /* The number of elements should be odd. */
299 if ((len % 2) == 0) 299 if ((len % 2) == 0)
@@ -326,8 +326,8 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
326 : COMPOSITION_WITH_RULE_ALTCHARS)); 326 : COMPOSITION_WITH_RULE_ALTCHARS));
327 cmp->hash_index = hash_index; 327 cmp->hash_index = hash_index;
328 glyph_len = (cmp->method == COMPOSITION_WITH_RULE_ALTCHARS 328 glyph_len = (cmp->method == COMPOSITION_WITH_RULE_ALTCHARS
329 ? (XVECTOR (key)->size + 1) / 2 329 ? (XVECTOR_SIZE (key) + 1) / 2
330 : XVECTOR (key)->size); 330 : XVECTOR_SIZE (key));
331 cmp->glyph_len = glyph_len; 331 cmp->glyph_len = glyph_len;
332 cmp->offsets = (short *) xmalloc (sizeof (short) * glyph_len * 2); 332 cmp->offsets = (short *) xmalloc (sizeof (short) * glyph_len * 2);
333 cmp->font = NULL; 333 cmp->font = NULL;
diff --git a/src/data.c b/src/data.c
index 4e81c80d0ed..68ea503d619 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1389,7 +1389,7 @@ for this variable. */)
1389 { 1389 {
1390 struct buffer *b; 1390 struct buffer *b;
1391 1391
1392 for (b = all_buffers; b; b = b->next) 1392 for (b = all_buffers; b; b = b->header.next.buffer)
1393 if (!PER_BUFFER_VALUE_P (b, idx)) 1393 if (!PER_BUFFER_VALUE_P (b, idx))
1394 PER_BUFFER_VALUE (b, offset) = value; 1394 PER_BUFFER_VALUE (b, offset) = value;
1395 } 1395 }
@@ -2093,9 +2093,9 @@ or a byte-code object. IDX starts at 0. */)
2093 { 2093 {
2094 int size = 0; 2094 int size = 0;
2095 if (VECTORP (array)) 2095 if (VECTORP (array))
2096 size = XVECTOR (array)->size; 2096 size = XVECTOR_SIZE (array);
2097 else if (COMPILEDP (array)) 2097 else if (COMPILEDP (array))
2098 size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK; 2098 size = XVECTOR_SIZE (array) & PSEUDOVECTOR_SIZE_MASK;
2099 else 2099 else
2100 wrong_type_argument (Qarrayp, array); 2100 wrong_type_argument (Qarrayp, array);
2101 2101
@@ -2120,7 +2120,7 @@ bool-vector. IDX starts at 0. */)
2120 2120
2121 if (VECTORP (array)) 2121 if (VECTORP (array))
2122 { 2122 {
2123 if (idxval < 0 || idxval >= XVECTOR (array)->size) 2123 if (idxval < 0 || idxval >= XVECTOR_SIZE (array))
2124 args_out_of_range (array, idx); 2124 args_out_of_range (array, idx);
2125 XVECTOR (array)->contents[idxval] = newelt; 2125 XVECTOR (array)->contents[idxval] = newelt;
2126 } 2126 }
diff --git a/src/dispnew.c b/src/dispnew.c
index 5b8eaf4fa34..4b77040c266 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6073,7 +6073,7 @@ pass nil for VARIABLE. */)
6073 state = frame_and_buffer_state; 6073 state = frame_and_buffer_state;
6074 6074
6075 vecp = XVECTOR (state)->contents; 6075 vecp = XVECTOR (state)->contents;
6076 end = vecp + XVECTOR (state)->size; 6076 end = vecp + XVECTOR_SIZE (state);
6077 6077
6078 FOR_EACH_FRAME (tail, frame) 6078 FOR_EACH_FRAME (tail, frame)
6079 { 6079 {
@@ -6124,8 +6124,8 @@ pass nil for VARIABLE. */)
6124 /* Reallocate the vector if data has grown to need it, 6124 /* Reallocate the vector if data has grown to need it,
6125 or if it has shrunk a lot. */ 6125 or if it has shrunk a lot. */
6126 if (! VECTORP (state) 6126 if (! VECTORP (state)
6127 || n > XVECTOR (state)->size 6127 || n > XVECTOR_SIZE (state)
6128 || n + 20 < XVECTOR (state)->size / 2) 6128 || n + 20 < XVECTOR_SIZE (state) / 2)
6129 /* Add 20 extra so we grow it less often. */ 6129 /* Add 20 extra so we grow it less often. */
6130 { 6130 {
6131 state = Fmake_vector (make_number (n + 20), Qlambda); 6131 state = Fmake_vector (make_number (n + 20), Qlambda);
@@ -6155,11 +6155,11 @@ pass nil for VARIABLE. */)
6155 /* Fill up the vector with lambdas (always at least one). */ 6155 /* Fill up the vector with lambdas (always at least one). */
6156 *vecp++ = Qlambda; 6156 *vecp++ = Qlambda;
6157 while (vecp - XVECTOR (state)->contents 6157 while (vecp - XVECTOR (state)->contents
6158 < XVECTOR (state)->size) 6158 < XVECTOR_SIZE (state))
6159 *vecp++ = Qlambda; 6159 *vecp++ = Qlambda;
6160 /* Make sure we didn't overflow the vector. */ 6160 /* Make sure we didn't overflow the vector. */
6161 if (vecp - XVECTOR (state)->contents 6161 if (vecp - XVECTOR (state)->contents
6162 > XVECTOR (state)->size) 6162 > XVECTOR_SIZE (state))
6163 abort (); 6163 abort ();
6164 return Qt; 6164 return Qt;
6165} 6165}
diff --git a/src/disptab.h b/src/disptab.h
index be611cb8a90..76fc586f137 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -54,7 +54,7 @@ extern Lisp_Object Qdisplay_table;
54/* Return the current length of the GLYPH table, 54/* Return the current length of the GLYPH table,
55 or 0 if the table isn't currently valid. */ 55 or 0 if the table isn't currently valid. */
56#define GLYPH_TABLE_LENGTH \ 56#define GLYPH_TABLE_LENGTH \
57 ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->size : 0) 57 ((VECTORP (Vglyph_table)) ? XVECTOR_SIZE (Vglyph_table) : 0)
58 58
59/* Return the current base (for indexing) of the GLYPH table, 59/* Return the current base (for indexing) of the GLYPH table,
60 or 0 if the table isn't currently valid. */ 60 or 0 if the table isn't currently valid. */
@@ -95,4 +95,3 @@ extern Lisp_Object Qdisplay_table;
95 95
96#define SET_GLYPH_FROM_CHAR(glyph, c) \ 96#define SET_GLYPH_FROM_CHAR(glyph, c) \
97 SET_GLYPH (glyph, c, DEFAULT_FACE_ID) 97 SET_GLYPH (glyph, c, DEFAULT_FACE_ID)
98
diff --git a/src/doc.c b/src/doc.c
index 74e06cce6b3..8c84e045e76 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -787,7 +787,7 @@ a new string, without any text properties, is returned. */)
787 do_remap: 787 do_remap:
788 tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil); 788 tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil);
789 789
790 if (VECTORP (tem) && XVECTOR (tem)->size > 1 790 if (VECTORP (tem) && XVECTOR_SIZE (tem) > 1
791 && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1)) 791 && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1))
792 && follow_remap) 792 && follow_remap)
793 { 793 {
diff --git a/src/fns.c b/src/fns.c
index 20190399f9a..a128b9292c6 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3681,9 +3681,9 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
3681 struct Lisp_Vector *next; 3681 struct Lisp_Vector *next;
3682 3682
3683 h2 = allocate_hash_table (); 3683 h2 = allocate_hash_table ();
3684 next = h2->vec_next; 3684 next = h2->header.next.vector;
3685 memcpy (h2, h1, sizeof *h2); 3685 memcpy (h2, h1, sizeof *h2);
3686 h2->vec_next = next; 3686 h2->header.next.vector = next;
3687 h2->key_and_value = Fcopy_sequence (h1->key_and_value); 3687 h2->key_and_value = Fcopy_sequence (h1->key_and_value);
3688 h2->hash = Fcopy_sequence (h1->hash); 3688 h2->hash = Fcopy_sequence (h1->hash);
3689 h2->next = Fcopy_sequence (h1->next); 3689 h2->next = Fcopy_sequence (h1->next);
@@ -4026,7 +4026,7 @@ sweep_weak_hash_tables (void)
4026 marked = 0; 4026 marked = 0;
4027 for (h = weak_hash_tables; h; h = h->next_weak) 4027 for (h = weak_hash_tables; h; h = h->next_weak)
4028 { 4028 {
4029 if (h->size & ARRAY_MARK_FLAG) 4029 if (h->header.size & ARRAY_MARK_FLAG)
4030 marked |= sweep_weak_table (h, 0); 4030 marked |= sweep_weak_table (h, 0);
4031 } 4031 }
4032 } 4032 }
@@ -4037,7 +4037,7 @@ sweep_weak_hash_tables (void)
4037 { 4037 {
4038 next = h->next_weak; 4038 next = h->next_weak;
4039 4039
4040 if (h->size & ARRAY_MARK_FLAG) 4040 if (h->header.size & ARRAY_MARK_FLAG)
4041 { 4041 {
4042 /* TABLE is marked as used. Sweep its contents. */ 4042 /* TABLE is marked as used. Sweep its contents. */
4043 if (h->count > 0) 4043 if (h->count > 0)
@@ -4153,7 +4153,7 @@ sxhash_bool_vector (Lisp_Object vec)
4153 unsigned hash = XBOOL_VECTOR (vec)->size; 4153 unsigned hash = XBOOL_VECTOR (vec)->size;
4154 int i, n; 4154 int i, n;
4155 4155
4156 n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->vector_size); 4156 n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size);
4157 for (i = 0; i < n; ++i) 4157 for (i = 0; i < n; ++i)
4158 hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]); 4158 hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]);
4159 4159
diff --git a/src/font.c b/src/font.c
index 2a8cf2e48a7..a393597e06c 100644
--- a/src/font.c
+++ b/src/font.c
@@ -253,7 +253,7 @@ font_intern_prop (const char *str, int len, int force_symbol)
253 /* The following code is copied from the function intern (in 253 /* The following code is copied from the function intern (in
254 lread.c), and modified to suite our purpose. */ 254 lread.c), and modified to suite our purpose. */
255 obarray = Vobarray; 255 obarray = Vobarray;
256 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 256 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
257 obarray = check_obarray (obarray); 257 obarray = check_obarray (obarray);
258 parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes); 258 parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes);
259 if (len == nchars || len != nbytes) 259 if (len == nchars || len != nbytes)
diff --git a/src/font.h b/src/font.h
index 7b43c2f99e7..b9ac80f2cda 100644
--- a/src/font.h
+++ b/src/font.h
@@ -254,8 +254,7 @@ extern Lisp_Object Qja, Qko;
254 254
255struct font_spec 255struct font_spec
256{ 256{
257 EMACS_UINT size; 257 struct vector_header header;
258 struct Lisp_Vector *next;
259 Lisp_Object props[FONT_SPEC_MAX]; 258 Lisp_Object props[FONT_SPEC_MAX];
260}; 259};
261 260
@@ -263,8 +262,7 @@ struct font_spec
263 262
264struct font_entity 263struct font_entity
265{ 264{
266 EMACS_UINT size; 265 struct vector_header header;
267 struct Lisp_Vector *next;
268 Lisp_Object props[FONT_ENTITY_MAX]; 266 Lisp_Object props[FONT_ENTITY_MAX];
269}; 267};
270 268
@@ -277,8 +275,7 @@ struct font_entity
277 275
278struct font 276struct font
279{ 277{
280 EMACS_UINT size; 278 struct vector_header header;
281 struct Lisp_Vector *next;
282 279
283 /* All Lisp_Object components must come first. 280 /* All Lisp_Object components must come first.
284 That ensures they are all aligned normally. */ 281 That ensures they are all aligned normally. */
diff --git a/src/frame.h b/src/frame.h
index 944a3270ae5..b1300484a7e 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -82,8 +82,7 @@ struct font_driver_list;
82 82
83struct frame 83struct frame
84{ 84{
85 EMACS_UINT size; 85 struct vector_header header;
86 struct Lisp_Vector *next;
87 86
88 /* All Lisp_Object components must come first. 87 /* All Lisp_Object components must come first.
89 That ensures they are all aligned normally. */ 88 That ensures they are all aligned normally. */
diff --git a/src/fringe.c b/src/fringe.c
index bc6b493584c..e910152effa 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1531,7 +1531,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1531 if (STRINGP (bits)) 1531 if (STRINGP (bits))
1532 h = SCHARS (bits); 1532 h = SCHARS (bits);
1533 else if (VECTORP (bits)) 1533 else if (VECTORP (bits))
1534 h = XVECTOR (bits)->size; 1534 h = XVECTOR_SIZE (bits);
1535 else 1535 else
1536 wrong_type_argument (Qsequencep, bits); 1536 wrong_type_argument (Qsequencep, bits);
1537 1537
diff --git a/src/image.c b/src/image.c
index fb555725b82..2346bb002e3 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2359,7 +2359,7 @@ xbm_image_p (Lisp_Object object)
2359 int i; 2359 int i;
2360 2360
2361 /* Number of elements of the vector must be >= height. */ 2361 /* Number of elements of the vector must be >= height. */
2362 if (XVECTOR (data)->size < height) 2362 if (XVECTOR_SIZE (data) < height)
2363 return 0; 2363 return 0;
2364 2364
2365 /* Each string or bool-vector in data must be large enough 2365 /* Each string or bool-vector in data must be large enough
@@ -8398,7 +8398,7 @@ gs_image_p (Lisp_Object object)
8398 } 8398 }
8399 else if (VECTORP (tem)) 8399 else if (VECTORP (tem))
8400 { 8400 {
8401 if (XVECTOR (tem)->size != 4) 8401 if (XVECTOR_SIZE (tem) != 4)
8402 return 0; 8402 return 0;
8403 for (i = 0; i < 4; ++i) 8403 for (i = 0; i < 4; ++i)
8404 if (!INTEGERP (XVECTOR (tem)->contents[i])) 8404 if (!INTEGERP (XVECTOR (tem)->contents[i]))
diff --git a/src/indent.c b/src/indent.c
index 094f6dabd55..a5ac2ab1d0c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -93,7 +93,7 @@ character_width (int c, struct Lisp_Char_Table *dp)
93 /* Everything can be handled by the display table, if it's 93 /* Everything can be handled by the display table, if it's
94 present and the element is right. */ 94 present and the element is right. */
95 if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt))) 95 if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt)))
96 return XVECTOR (elt)->size; 96 return XVECTOR_SIZE (elt);
97 97
98 /* Some characters are special. */ 98 /* Some characters are special. */
99 if (c == '\n' || c == '\t' || c == '\015') 99 if (c == '\n' || c == '\t' || c == '\015')
@@ -121,7 +121,7 @@ disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *w
121{ 121{
122 int i; 122 int i;
123 123
124 if (widthtab->size != 256) 124 if (widthtab->header.size != 256)
125 abort (); 125 abort ();
126 126
127 for (i = 0; i < 256; i++) 127 for (i = 0; i < 256; i++)
@@ -143,7 +143,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
143 if (!VECTORP (BVAR (buf, width_table))) 143 if (!VECTORP (BVAR (buf, width_table)))
144 BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0)); 144 BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0));
145 widthtab = XVECTOR (BVAR (buf, width_table)); 145 widthtab = XVECTOR (BVAR (buf, width_table));
146 if (widthtab->size != 256) 146 if (widthtab->header.size != 256)
147 abort (); 147 abort ();
148 148
149 for (i = 0; i < 256; i++) 149 for (i = 0; i < 256; i++)
@@ -284,7 +284,7 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob
284 else \ 284 else \
285 { \ 285 { \
286 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ 286 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \
287 width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ 287 width = XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, ch)); \
288 else \ 288 else \
289 width = CHAR_WIDTH (ch); \ 289 width = CHAR_WIDTH (ch); \
290 } \ 290 } \
@@ -766,7 +766,7 @@ string_display_width (string, beg, end)
766 766
767 c = *--ptr; 767 c = *--ptr;
768 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) 768 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
769 col += XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; 769 col += XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c));
770 else if (c >= 040 && c < 0177) 770 else if (c >= 040 && c < 0177)
771 col++; 771 col++;
772 else if (c == '\n') 772 else if (c == '\n')
@@ -1127,7 +1127,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1127 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); 1127 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
1128 int selective_rlen 1128 int selective_rlen
1129 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) 1129 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
1130 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0); 1130 ? XVECTOR_SIZE (DISP_INVIS_VECTOR (dp)) : 0);
1131 /* The next location where the `invisible' property changes, or an 1131 /* The next location where the `invisible' property changes, or an
1132 overlay starts or ends. */ 1132 overlay starts or ends. */
1133 EMACS_INT next_boundary = from; 1133 EMACS_INT next_boundary = from;
diff --git a/src/keyboard.c b/src/keyboard.c
index b0ae1b1868d..8c4f7bdf804 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -134,7 +134,7 @@ static Lisp_Object raw_keybuf;
134static int raw_keybuf_count; 134static int raw_keybuf_count;
135 135
136#define GROW_RAW_KEYBUF \ 136#define GROW_RAW_KEYBUF \
137 if (raw_keybuf_count == XVECTOR (raw_keybuf)->size) \ 137 if (raw_keybuf_count == XVECTOR_SIZE (raw_keybuf)) \
138 raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \ 138 raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \
139 139
140/* Number of elements of this_command_keys 140/* Number of elements of this_command_keys
@@ -2898,7 +2898,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2898 if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) 2898 if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table))
2899 && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c)) 2899 && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
2900 || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table)) 2900 || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table))
2901 && XVECTOR (KVAR (current_kboard, Vkeyboard_translate_table))->size > (unsigned) XFASTINT (c)) 2901 && XVECTOR_SIZE (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
2902 || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table)) 2902 || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table))
2903 && CHARACTERP (c))) 2903 && CHARACTERP (c)))
2904 { 2904 {
@@ -4198,7 +4198,7 @@ timer_start_idle (void)
4198 4198
4199 timer = XCAR (timers); 4199 timer = XCAR (timers);
4200 4200
4201 if (!VECTORP (timer) || XVECTOR (timer)->size != 8) 4201 if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
4202 continue; 4202 continue;
4203 XVECTOR (timer)->contents[0] = Qnil; 4203 XVECTOR (timer)->contents[0] = Qnil;
4204 } 4204 }
@@ -4293,7 +4293,7 @@ timer_check_2 (void)
4293 if (CONSP (timers)) 4293 if (CONSP (timers))
4294 { 4294 {
4295 timer = XCAR (timers); 4295 timer = XCAR (timers);
4296 if (!VECTORP (timer) || XVECTOR (timer)->size != 8) 4296 if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
4297 { 4297 {
4298 timers = XCDR (timers); 4298 timers = XCDR (timers);
4299 continue; 4299 continue;
@@ -4311,7 +4311,7 @@ timer_check_2 (void)
4311 if (CONSP (idle_timers)) 4311 if (CONSP (idle_timers))
4312 { 4312 {
4313 timer = XCAR (idle_timers); 4313 timer = XCAR (idle_timers);
4314 if (!VECTORP (timer) || XVECTOR (timer)->size != 8) 4314 if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
4315 { 4315 {
4316 idle_timers = XCDR (idle_timers); 4316 idle_timers = XCDR (idle_timers);
4317 continue; 4317 continue;
@@ -5459,7 +5459,7 @@ make_lispy_event (struct input_event *event)
5459 /* Find the menu bar item under `column'. */ 5459 /* Find the menu bar item under `column'. */
5460 item = Qnil; 5460 item = Qnil;
5461 items = FRAME_MENU_BAR_ITEMS (f); 5461 items = FRAME_MENU_BAR_ITEMS (f);
5462 for (i = 0; i < XVECTOR (items)->size; i += 4) 5462 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
5463 { 5463 {
5464 Lisp_Object pos, string; 5464 Lisp_Object pos, string;
5465 string = AREF (items, i + 1); 5465 string = AREF (items, i + 1);
@@ -5652,7 +5652,7 @@ make_lispy_event (struct input_event *event)
5652 Qmouse_click, Vlispy_mouse_stem, 5652 Qmouse_click, Vlispy_mouse_stem,
5653 NULL, 5653 NULL,
5654 &mouse_syms, 5654 &mouse_syms,
5655 XVECTOR (mouse_syms)->size); 5655 XVECTOR_SIZE (mouse_syms));
5656 if (event->modifiers & drag_modifier) 5656 if (event->modifiers & drag_modifier)
5657 return Fcons (head, 5657 return Fcons (head,
5658 Fcons (start_pos, 5658 Fcons (start_pos,
@@ -5823,7 +5823,7 @@ make_lispy_event (struct input_event *event)
5823 Qmouse_click, 5823 Qmouse_click,
5824 Vlispy_mouse_stem, 5824 Vlispy_mouse_stem,
5825 NULL, &mouse_syms, 5825 NULL, &mouse_syms,
5826 XVECTOR (mouse_syms)->size); 5826 XVECTOR_SIZE (mouse_syms));
5827 return Fcons (head, Fcons (position, Qnil)); 5827 return Fcons (head, Fcons (position, Qnil));
5828 } 5828 }
5829 5829
@@ -5943,7 +5943,7 @@ make_lispy_event (struct input_event *event)
5943 Qmouse_click, Vlispy_mouse_stem, 5943 Qmouse_click, Vlispy_mouse_stem,
5944 NULL, 5944 NULL,
5945 &mouse_syms, 5945 &mouse_syms,
5946 XVECTOR (mouse_syms)->size); 5946 XVECTOR_SIZE (mouse_syms));
5947 5947
5948 if (event->modifiers & drag_modifier) 5948 if (event->modifiers & drag_modifier)
5949 return Fcons (head, 5949 return Fcons (head,
@@ -6422,7 +6422,7 @@ modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object s
6422 else 6422 else
6423 { 6423 {
6424 if (! VECTORP (*symbol_table) 6424 if (! VECTORP (*symbol_table)
6425 || XVECTOR (*symbol_table)->size != table_size) 6425 || XVECTOR_SIZE (*symbol_table) != table_size)
6426 { 6426 {
6427 Lisp_Object size; 6427 Lisp_Object size;
6428 6428
@@ -7479,7 +7479,7 @@ menu_bar_items (Lisp_Object old)
7479 /* Add nil, nil, nil, nil at the end. */ 7479 /* Add nil, nil, nil, nil at the end. */
7480 { 7480 {
7481 int i = menu_bar_items_index; 7481 int i = menu_bar_items_index;
7482 if (i + 4 > XVECTOR (menu_bar_items_vector)->size) 7482 if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
7483 menu_bar_items_vector = 7483 menu_bar_items_vector =
7484 larger_vector (menu_bar_items_vector, 2 * i, Qnil); 7484 larger_vector (menu_bar_items_vector, 2 * i, Qnil);
7485 /* Add this item. */ 7485 /* Add this item. */
@@ -7551,7 +7551,7 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
7551 if (i == menu_bar_items_index) 7551 if (i == menu_bar_items_index)
7552 { 7552 {
7553 /* If vector is too small, get a bigger one. */ 7553 /* If vector is too small, get a bigger one. */
7554 if (i + 4 > XVECTOR (menu_bar_items_vector)->size) 7554 if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
7555 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); 7555 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
7556 /* Add this item. */ 7556 /* Add this item. */
7557 XVECTOR (menu_bar_items_vector)->contents[i++] = key; 7557 XVECTOR (menu_bar_items_vector)->contents[i++] = key;
@@ -8219,7 +8219,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8219 } 8219 }
8220 else if (EQ (ikey, QCimage) 8220 else if (EQ (ikey, QCimage)
8221 && (CONSP (value) 8221 && (CONSP (value)
8222 || (VECTORP (value) && XVECTOR (value)->size == 4))) 8222 || (VECTORP (value) && XVECTOR_SIZE (value) == 4)))
8223 /* Value is either a single image specification or a vector 8223 /* Value is either a single image specification or a vector
8224 of 4 such specifications for the different button states. */ 8224 of 4 such specifications for the different button states. */
8225 PROP (TOOL_BAR_ITEM_IMAGES) = value; 8225 PROP (TOOL_BAR_ITEM_IMAGES) = value;
@@ -8323,10 +8323,10 @@ append_tool_bar_item (void)
8323 8323
8324 /* Enlarge tool_bar_items_vector if necessary. */ 8324 /* Enlarge tool_bar_items_vector if necessary. */
8325 if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS 8325 if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
8326 >= XVECTOR (tool_bar_items_vector)->size) 8326 >= XVECTOR_SIZE (tool_bar_items_vector))
8327 tool_bar_items_vector 8327 tool_bar_items_vector
8328 = larger_vector (tool_bar_items_vector, 8328 = larger_vector (tool_bar_items_vector,
8329 2 * XVECTOR (tool_bar_items_vector)->size, Qnil); 8329 2 * XVECTOR_SIZE (tool_bar_items_vector), Qnil);
8330 8330
8331 /* Append entries from tool_bar_item_properties to the end of 8331 /* Append entries from tool_bar_item_properties to the end of
8332 tool_bar_items_vector. */ 8332 tool_bar_items_vector. */
@@ -8648,7 +8648,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
8648 } 8648 }
8649 8649
8650 /* Move past this element. */ 8650 /* Move past this element. */
8651 if (idx >= 0 && idx + 1 >= XVECTOR (vector)->size) 8651 if (idx >= 0 && idx + 1 >= XVECTOR_SIZE (vector))
8652 /* Handle reaching end of dense table. */ 8652 /* Handle reaching end of dense table. */
8653 idx = -1; 8653 idx = -1;
8654 if (idx >= 0) 8654 if (idx >= 0)
@@ -9926,7 +9926,7 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt,
9926 /* Treat uppercase keys as shifted. */ 9926 /* Treat uppercase keys as shifted. */
9927 || (INTEGERP (key) 9927 || (INTEGERP (key)
9928 && (KEY_TO_CHAR (key) 9928 && (KEY_TO_CHAR (key)
9929 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size) 9929 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->header.size)
9930 && uppercasep (KEY_TO_CHAR (key)))) 9930 && uppercasep (KEY_TO_CHAR (key))))
9931 { 9931 {
9932 Lisp_Object new_key 9932 Lisp_Object new_key
@@ -10292,7 +10292,7 @@ give to the command you invoke, if it asks for an argument. */)
10292 this_single_command_key_start = 0; 10292 this_single_command_key_start = 0;
10293 10293
10294 keys = XVECTOR (saved_keys)->contents; 10294 keys = XVECTOR (saved_keys)->contents;
10295 for (i = 0; i < XVECTOR (saved_keys)->size; i++) 10295 for (i = 0; i < XVECTOR_SIZE (saved_keys); i++)
10296 add_command_key (keys[i]); 10296 add_command_key (keys[i]);
10297 10297
10298 for (i = 0; i < SCHARS (function); i++) 10298 for (i = 0; i < SCHARS (function); i++)
@@ -10585,7 +10585,7 @@ KEEP-RECORD is non-nil. */)
10585 10585
10586 if (NILP (keep_record)) 10586 if (NILP (keep_record))
10587 { 10587 {
10588 for (i = 0; i < XVECTOR (recent_keys)->size; ++i) 10588 for (i = 0; i < XVECTOR_SIZE (recent_keys); ++i)
10589 XVECTOR (recent_keys)->contents[i] = Qnil; 10589 XVECTOR (recent_keys)->contents[i] = Qnil;
10590 total_keys = 0; 10590 total_keys = 0;
10591 recent_keys_index = 0; 10591 recent_keys_index = 0;
diff --git a/src/keymap.c b/src/keymap.c
index 8713bcf1279..110447b19ff 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -359,7 +359,7 @@ Return PARENT. PARENT should be nil or another keymap. */)
359 XCDR (XCAR (list))); 359 XCDR (XCAR (list)));
360 360
361 if (VECTORP (XCAR (list))) 361 if (VECTORP (XCAR (list)))
362 for (i = 0; i < XVECTOR (XCAR (list))->size; i++) 362 for (i = 0; i < XVECTOR_SIZE (XCAR (list)); i++)
363 if (CONSP (XVECTOR (XCAR (list))->contents[i])) 363 if (CONSP (XVECTOR (XCAR (list))->contents[i]))
364 fix_submap_inheritance (keymap, make_number (i), 364 fix_submap_inheritance (keymap, make_number (i),
365 XVECTOR (XCAR (list))->contents[i]); 365 XVECTOR (XCAR (list))->contents[i]);
@@ -2226,7 +2226,7 @@ spaces are put between sequence elements, etc. */)
2226 if (STRINGP (list)) 2226 if (STRINGP (list))
2227 size = SCHARS (list); 2227 size = SCHARS (list);
2228 else if (VECTORP (list)) 2228 else if (VECTORP (list))
2229 size = XVECTOR (list)->size; 2229 size = XVECTOR_SIZE (list);
2230 else if (CONSP (list)) 2230 else if (CONSP (list))
2231 size = XINT (Flength (list)); 2231 size = XINT (Flength (list));
2232 else 2232 else
@@ -3125,7 +3125,7 @@ key binding\n\
3125 3125
3126 elt = XCAR (list); 3126 elt = XCAR (list);
3127 elt_prefix = Fcar (elt); 3127 elt_prefix = Fcar (elt);
3128 if (XVECTOR (elt_prefix)->size >= 1) 3128 if (XVECTOR_SIZE (elt_prefix) >= 1)
3129 { 3129 {
3130 tem = Faref (elt_prefix, make_number (0)); 3130 tem = Faref (elt_prefix, make_number (0));
3131 if (EQ (tem, Qmenu_bar)) 3131 if (EQ (tem, Qmenu_bar))
@@ -3168,7 +3168,7 @@ key binding\n\
3168 /* If the sequence by which we reach this keymap is zero-length, 3168 /* If the sequence by which we reach this keymap is zero-length,
3169 then the shadow map for this keymap is just SHADOW. */ 3169 then the shadow map for this keymap is just SHADOW. */
3170 if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0) 3170 if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0)
3171 || (VECTORP (elt_prefix) && XVECTOR (elt_prefix)->size == 0)) 3171 || (VECTORP (elt_prefix) && XVECTOR_SIZE (elt_prefix) == 0))
3172 ; 3172 ;
3173 /* If the sequence by which we reach this keymap actually has 3173 /* If the sequence by which we reach this keymap actually has
3174 some elements, then the sequence's definition in SHADOW is 3174 some elements, then the sequence's definition in SHADOW is
@@ -3592,7 +3592,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3592 if (CHAR_TABLE_P (vector)) 3592 if (CHAR_TABLE_P (vector))
3593 stop = MAX_5_BYTE_CHAR + 1, to = MAX_CHAR + 1; 3593 stop = MAX_5_BYTE_CHAR + 1, to = MAX_CHAR + 1;
3594 else 3594 else
3595 stop = to = XVECTOR (vector)->size; 3595 stop = to = XVECTOR_SIZE (vector);
3596 3596
3597 for (i = from; ; i++) 3597 for (i = from; ; i++)
3598 { 3598 {
diff --git a/src/lisp.h b/src/lisp.h
index 5bace90e53e..e717e7c5cdb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -554,6 +554,11 @@ extern Lisp_Object make_number (EMACS_INT);
554#define XSYMBOL(a) (eassert (SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a)) 554#define XSYMBOL(a) (eassert (SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
555#define XFLOAT(a) (eassert (FLOATP(a)),(struct Lisp_Float *) XPNTR(a)) 555#define XFLOAT(a) (eassert (FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
556 556
557/* Extract the size field of a vector or vector-like object. */
558
559#define XVECTOR_SIZE(a) (XVECTOR (a)->header.size + 0)
560#define XVECTOR_HEADER_SIZE(a) (((struct vector_header *) XPNTR (a))->size + 0)
561
557/* Misc types. */ 562/* Misc types. */
558 563
559#define XMISC(a) ((union Lisp_Misc *) XPNTR(a)) 564#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
@@ -601,17 +606,24 @@ extern Lisp_Object make_number (EMACS_INT);
601 606
602/* Pseudovector types. */ 607/* Pseudovector types. */
603 608
604#define XSETPVECTYPE(v,code) ((v)->size |= PSEUDOVECTOR_FLAG | (code)) 609#define XSETPVECTYPE(v, code) XSETTYPED_PVECTYPE(v, header.size, code)
610#define XSETTYPED_PVECTYPE(v, size_member, code) \
611 ((v)->size_member |= PSEUDOVECTOR_FLAG | (code))
612#define XSETPVECTYPESIZE(v, code, sizeval) \
613 ((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval))
605#define XSETPSEUDOVECTOR(a, b, code) \ 614#define XSETPSEUDOVECTOR(a, b, code) \
615 XSETTYPED_PSEUDOVECTOR(a, b, XVECTOR_HEADER_SIZE (a), code)
616#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \
606 (XSETVECTOR (a, b), \ 617 (XSETVECTOR (a, b), \
607 eassert ((XVECTOR (a)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \ 618 eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \
608 == (PSEUDOVECTOR_FLAG | (code)))) 619 == (PSEUDOVECTOR_FLAG | (code))))
609#define XSETWINDOW_CONFIGURATION(a, b) \ 620#define XSETWINDOW_CONFIGURATION(a, b) \
610 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION)) 621 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
611#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS)) 622#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
612#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) 623#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
613#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) 624#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
614#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) 625#define XSETSUBR(a, b) \
626 XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR)
615#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) 627#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
616#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) 628#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
617#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) 629#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
@@ -621,7 +633,7 @@ extern Lisp_Object make_number (EMACS_INT);
621/* Convenience macros for dealing with Lisp arrays. */ 633/* Convenience macros for dealing with Lisp arrays. */
622 634
623#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX] 635#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
624#define ASIZE(ARRAY) XVECTOR ((ARRAY))->size 636#define ASIZE(ARRAY) XVECTOR_SIZE (ARRAY)
625/* The IDX==IDX tries to detect when the macro argument is side-effecting. */ 637/* The IDX==IDX tries to detect when the macro argument is side-effecting. */
626#define ASET(ARRAY, IDX, VAL) \ 638#define ASET(ARRAY, IDX, VAL) \
627 (eassert ((IDX) == (IDX)), \ 639 (eassert ((IDX) == (IDX)), \
@@ -778,10 +790,21 @@ struct Lisp_String
778 unsigned char *data; 790 unsigned char *data;
779 }; 791 };
780 792
781struct Lisp_Vector 793/* Header of vector-like objects. This type documents the constraints on
794 layout of vectors and pseudovectors, and helps optimizing compilers not get
795 fooled by Emacs's type punning. */
796struct vector_header
782 { 797 {
783 EMACS_UINT size; 798 EMACS_UINT size;
784 struct Lisp_Vector *next; 799 union {
800 struct buffer *buffer;
801 struct Lisp_Vector *vector;
802 } next;
803 };
804
805struct Lisp_Vector
806 {
807 struct vector_header header;
785 Lisp_Object contents[1]; 808 Lisp_Object contents[1];
786 }; 809 };
787 810
@@ -817,7 +840,7 @@ struct Lisp_Vector
817/* Return the number of "extra" slots in the char table CT. */ 840/* Return the number of "extra" slots in the char table CT. */
818 841
819#define CHAR_TABLE_EXTRA_SLOTS(CT) \ 842#define CHAR_TABLE_EXTRA_SLOTS(CT) \
820 (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) 843 (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
821 844
822#ifdef __GNUC__ 845#ifdef __GNUC__
823 846
@@ -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 vector_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 vector_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 vector_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 vector_header and its 'next' field. */
956 976
957struct Lisp_Subr 977struct Lisp_Subr
958 { 978 {
@@ -1099,9 +1119,8 @@ struct Lisp_Symbol
1099 1119
1100struct Lisp_Hash_Table 1120struct Lisp_Hash_Table
1101{ 1121{
1102 /* Vector fields. The hash table code doesn't refer to these. */ 1122 /* This is for Lisp; the hash table code does not refer to it. */
1103 EMACS_UINT size; 1123 struct vector_header header;
1104 struct Lisp_Vector *vec_next;
1105 1124
1106 /* Function used to compare keys. */ 1125 /* Function used to compare keys. */
1107 Lisp_Object test; 1126 Lisp_Object test;
@@ -1202,7 +1221,7 @@ struct Lisp_Hash_Table
1202 1221
1203/* Value is the size of hash table H. */ 1222/* Value is the size of hash table H. */
1204 1223
1205#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size 1224#define HASH_TABLE_SIZE(H) XVECTOR_SIZE ((H)->next)
1206 1225
1207/* Default size for hash tables if not specified. */ 1226/* Default size for hash tables if not specified. */
1208 1227
@@ -1620,7 +1639,7 @@ typedef struct {
1620#define CONSP(x) (XTYPE ((x)) == Lisp_Cons) 1639#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
1621 1640
1622#define FLOATP(x) (XTYPE ((x)) == Lisp_Float) 1641#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
1623#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG)) 1642#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR_SIZE (x) & PSEUDOVECTOR_FLAG))
1624#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay) 1643#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1625#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker) 1644#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1626#define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value) 1645#define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value)
@@ -1633,8 +1652,14 @@ typedef struct {
1633 1652
1634/* True if object X is a pseudovector whose code is CODE. */ 1653/* True if object X is a pseudovector whose code is CODE. */
1635#define PSEUDOVECTORP(x, code) \ 1654#define PSEUDOVECTORP(x, code) \
1655 TYPED_PSEUDOVECTORP(x, vector_header, code)
1656
1657/* True if object X, with internal type struct T *, is a pseudovector whose
1658 code is CODE. */
1659#define TYPED_PSEUDOVECTORP(x, t, code) \
1636 (VECTORLIKEP (x) \ 1660 (VECTORLIKEP (x) \
1637 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \ 1661 && (((((struct t *) XPNTR (x))->size \
1662 & (PSEUDOVECTOR_FLAG | (code)))) \
1638 == (PSEUDOVECTOR_FLAG | (code)))) 1663 == (PSEUDOVECTOR_FLAG | (code))))
1639 1664
1640/* Test for specific pseudovector types. */ 1665/* Test for specific pseudovector types. */
@@ -1642,7 +1667,7 @@ typedef struct {
1642#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS) 1667#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
1643#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW) 1668#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
1644#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL) 1669#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
1645#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR) 1670#define SUBRP(x) TYPED_PSEUDOVECTORP (x, Lisp_Subr, PVEC_SUBR)
1646#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED) 1671#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
1647#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) 1672#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
1648#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE) 1673#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
diff --git a/src/lread.c b/src/lread.c
index 3306c38e937..2ce2a4398a1 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2430,7 +2430,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2430 { 2430 {
2431 Lisp_Object tmp; 2431 Lisp_Object tmp;
2432 tmp = read_vector (readcharfun, 0); 2432 tmp = read_vector (readcharfun, 0);
2433 if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS) 2433 if (XVECTOR_SIZE (tmp) < CHAR_TABLE_STANDARD_SLOTS)
2434 error ("Invalid size char-table"); 2434 error ("Invalid size char-table");
2435 XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE); 2435 XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE);
2436 return tmp; 2436 return tmp;
@@ -2449,7 +2449,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2449 depth = XINT (AREF (tmp, 0)); 2449 depth = XINT (AREF (tmp, 0));
2450 if (depth < 1 || depth > 3) 2450 if (depth < 1 || depth > 3)
2451 error ("Invalid depth in char-table"); 2451 error ("Invalid depth in char-table");
2452 size = XVECTOR (tmp)->size - 2; 2452 size = XVECTOR_SIZE (tmp) - 2;
2453 if (chartab_size [depth] != size) 2453 if (chartab_size [depth] != size)
2454 error ("Invalid size char-table"); 2454 error ("Invalid size char-table");
2455 XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE); 2455 XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
@@ -2499,7 +2499,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2499 build them using function calls. */ 2499 build them using function calls. */
2500 Lisp_Object tmp; 2500 Lisp_Object tmp;
2501 tmp = read_vector (readcharfun, 1); 2501 tmp = read_vector (readcharfun, 1);
2502 return Fmake_byte_code (XVECTOR (tmp)->size, 2502 return Fmake_byte_code (XVECTOR_SIZE (tmp),
2503 XVECTOR (tmp)->contents); 2503 XVECTOR (tmp)->contents);
2504 } 2504 }
2505 if (c == '(') 2505 if (c == '(')
@@ -3356,7 +3356,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3356 len = Flength (tem); 3356 len = Flength (tem);
3357 vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil)); 3357 vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil));
3358 3358
3359 size = XVECTOR (vector)->size; 3359 size = XVECTOR_SIZE (vector);
3360 ptr = XVECTOR (vector)->contents; 3360 ptr = XVECTOR (vector)->contents;
3361 for (i = 0; i < size; i++) 3361 for (i = 0; i < size; i++)
3362 { 3362 {
@@ -3621,7 +3621,7 @@ static int hash_string (const char *ptr, int len);
3621Lisp_Object 3621Lisp_Object
3622check_obarray (Lisp_Object obarray) 3622check_obarray (Lisp_Object obarray)
3623{ 3623{
3624 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3624 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
3625 { 3625 {
3626 /* If Vobarray is now invalid, force it to be valid. */ 3626 /* If Vobarray is now invalid, force it to be valid. */
3627 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray; 3627 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
@@ -3641,7 +3641,7 @@ intern (const char *str)
3641 Lisp_Object obarray; 3641 Lisp_Object obarray;
3642 3642
3643 obarray = Vobarray; 3643 obarray = Vobarray;
3644 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3644 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
3645 obarray = check_obarray (obarray); 3645 obarray = check_obarray (obarray);
3646 tem = oblookup (obarray, str, len, len); 3646 tem = oblookup (obarray, str, len, len);
3647 if (SYMBOLP (tem)) 3647 if (SYMBOLP (tem))
@@ -3657,7 +3657,7 @@ intern_c_string (const char *str)
3657 Lisp_Object obarray; 3657 Lisp_Object obarray;
3658 3658
3659 obarray = Vobarray; 3659 obarray = Vobarray;
3660 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3660 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
3661 obarray = check_obarray (obarray); 3661 obarray = check_obarray (obarray);
3662 tem = oblookup (obarray, str, len, len); 3662 tem = oblookup (obarray, str, len, len);
3663 if (SYMBOLP (tem)) 3663 if (SYMBOLP (tem))
@@ -3830,10 +3830,10 @@ oblookup (Lisp_Object obarray, register const char *ptr, EMACS_INT size, EMACS_I
3830 Lisp_Object bucket, tem; 3830 Lisp_Object bucket, tem;
3831 3831
3832 if (!VECTORP (obarray) 3832 if (!VECTORP (obarray)
3833 || (obsize = XVECTOR (obarray)->size) == 0) 3833 || (obsize = XVECTOR_SIZE (obarray)) == 0)
3834 { 3834 {
3835 obarray = check_obarray (obarray); 3835 obarray = check_obarray (obarray);
3836 obsize = XVECTOR (obarray)->size; 3836 obsize = XVECTOR_SIZE (obarray);
3837 } 3837 }
3838 /* This is sometimes needed in the middle of GC. */ 3838 /* This is sometimes needed in the middle of GC. */
3839 obsize &= ~ARRAY_MARK_FLAG; 3839 obsize &= ~ARRAY_MARK_FLAG;
@@ -3881,7 +3881,7 @@ map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Ob
3881 register int i; 3881 register int i;
3882 register Lisp_Object tail; 3882 register Lisp_Object tail;
3883 CHECK_VECTOR (obarray); 3883 CHECK_VECTOR (obarray);
3884 for (i = XVECTOR (obarray)->size - 1; i >= 0; i--) 3884 for (i = XVECTOR_SIZE (obarray) - 1; i >= 0; i--)
3885 { 3885 {
3886 tail = XVECTOR (obarray)->contents[i]; 3886 tail = XVECTOR (obarray)->contents[i];
3887 if (SYMBOLP (tail)) 3887 if (SYMBOLP (tail))
@@ -3961,7 +3961,7 @@ defsubr (struct Lisp_Subr *sname)
3961{ 3961{
3962 Lisp_Object sym; 3962 Lisp_Object sym;
3963 sym = intern_c_string (sname->symbol_name); 3963 sym = intern_c_string (sname->symbol_name);
3964 XSETPVECTYPE (sname, PVEC_SUBR); 3964 XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR);
3965 XSETSUBR (XSYMBOL (sym)->function, sname); 3965 XSETSUBR (XSYMBOL (sym)->function, sname);
3966} 3966}
3967 3967
diff --git a/src/minibuf.c b/src/minibuf.c
index 6316ba514b9..b73b2418cd6 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1227,7 +1227,7 @@ is used to further constrain the set of candidates. */)
1227 if (type == obarray_table) 1227 if (type == obarray_table)
1228 { 1228 {
1229 collection = check_obarray (collection); 1229 collection = check_obarray (collection);
1230 obsize = XVECTOR (collection)->size; 1230 obsize = XVECTOR_SIZE (collection);
1231 bucket = XVECTOR (collection)->contents[idx]; 1231 bucket = XVECTOR (collection)->contents[idx];
1232 } 1232 }
1233 1233
@@ -1490,7 +1490,7 @@ with a space are ignored unless STRING itself starts with a space. */)
1490 if (type == 2) 1490 if (type == 2)
1491 { 1491 {
1492 collection = check_obarray (collection); 1492 collection = check_obarray (collection);
1493 obsize = XVECTOR (collection)->size; 1493 obsize = XVECTOR_SIZE (collection);
1494 bucket = XVECTOR (collection)->contents[idx]; 1494 bucket = XVECTOR (collection)->contents[idx];
1495 } 1495 }
1496 1496
@@ -1804,7 +1804,7 @@ the values STRING, PREDICATE and `lambda'. */)
1804 1804
1805 if (completion_ignore_case && !SYMBOLP (tem)) 1805 if (completion_ignore_case && !SYMBOLP (tem))
1806 { 1806 {
1807 for (i = XVECTOR (collection)->size - 1; i >= 0; i--) 1807 for (i = XVECTOR_SIZE (collection) - 1; i >= 0; i--)
1808 { 1808 {
1809 tail = XVECTOR (collection)->contents[i]; 1809 tail = XVECTOR (collection)->contents[i];
1810 if (SYMBOLP (tail)) 1810 if (SYMBOLP (tail))
diff --git a/src/print.c b/src/print.c
index 2c9aa9dfd85..8f559045f89 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1198,7 +1198,7 @@ print_preprocess (Lisp_Object obj)
1198 goto loop; 1198 goto loop;
1199 1199
1200 case Lisp_Vectorlike: 1200 case Lisp_Vectorlike:
1201 size = XVECTOR (obj)->size; 1201 size = XVECTOR_SIZE (obj);
1202 if (size & PSEUDOVECTOR_FLAG) 1202 if (size & PSEUDOVECTOR_FLAG)
1203 size &= PSEUDOVECTOR_SIZE_MASK; 1203 size &= PSEUDOVECTOR_SIZE_MASK;
1204 for (i = 0; i < size; i++) 1204 for (i = 0; i < size; i++)
@@ -1786,7 +1786,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1786 strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun); 1786 strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun);
1787 PRINTCHAR (' '); 1787 PRINTCHAR (' ');
1788 sprintf (buf, "%ld/%ld", (long) h->count, 1788 sprintf (buf, "%ld/%ld", (long) h->count,
1789 (long) XVECTOR (h->next)->size); 1789 (long) XVECTOR_SIZE (h->next));
1790 strout (buf, -1, -1, printcharfun); 1790 strout (buf, -1, -1, printcharfun);
1791 } 1791 }
1792 sprintf (buf, " 0x%lx", (unsigned long) h); 1792 sprintf (buf, " 0x%lx", (unsigned long) h);
@@ -1797,7 +1797,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1797 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ 1797 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
1798 /* Always print the size. */ 1798 /* Always print the size. */
1799 sprintf (buf, "#s(hash-table size %ld", 1799 sprintf (buf, "#s(hash-table size %ld",
1800 (long) XVECTOR (h->next)->size); 1800 (long) XVECTOR_SIZE (h->next));
1801 strout (buf, -1, -1, printcharfun); 1801 strout (buf, -1, -1, printcharfun);
1802 1802
1803 if (!NILP (h->test)) 1803 if (!NILP (h->test))
@@ -1909,7 +1909,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1909 } 1909 }
1910 else 1910 else
1911 { 1911 {
1912 EMACS_INT size = XVECTOR (obj)->size; 1912 EMACS_INT size = XVECTOR_SIZE (obj);
1913 if (COMPILEDP (obj)) 1913 if (COMPILEDP (obj))
1914 { 1914 {
1915 PRINTCHAR ('#'); 1915 PRINTCHAR ('#');
@@ -2025,7 +2025,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2025 if (MISCP (obj)) 2025 if (MISCP (obj))
2026 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj)); 2026 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
2027 else if (VECTORLIKEP (obj)) 2027 else if (VECTORLIKEP (obj))
2028 sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR (obj)->size); 2028 sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR_SIZE (obj));
2029 else 2029 else
2030 sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); 2030 sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
2031 strout (buf, -1, -1, printcharfun); 2031 strout (buf, -1, -1, printcharfun);
diff --git a/src/process.c b/src/process.c
index f25d10dbd67..89a5f3e0386 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1188,25 +1188,26 @@ Returns nil if format of ADDRESS is invalid. */)
1188 if (VECTORP (address)) /* AF_INET or AF_INET6 */ 1188 if (VECTORP (address)) /* AF_INET or AF_INET6 */
1189 { 1189 {
1190 register struct Lisp_Vector *p = XVECTOR (address); 1190 register struct Lisp_Vector *p = XVECTOR (address);
1191 EMACS_UINT size = p->header.size;
1191 Lisp_Object args[10]; 1192 Lisp_Object args[10];
1192 int nargs, i; 1193 int nargs, i;
1193 1194
1194 if (p->size == 4 || (p->size == 5 && !NILP (omit_port))) 1195 if (size == 4 || (size == 5 && !NILP (omit_port)))
1195 { 1196 {
1196 args[0] = build_string ("%d.%d.%d.%d"); 1197 args[0] = build_string ("%d.%d.%d.%d");
1197 nargs = 4; 1198 nargs = 4;
1198 } 1199 }
1199 else if (p->size == 5) 1200 else if (size == 5)
1200 { 1201 {
1201 args[0] = build_string ("%d.%d.%d.%d:%d"); 1202 args[0] = build_string ("%d.%d.%d.%d:%d");
1202 nargs = 5; 1203 nargs = 5;
1203 } 1204 }
1204 else if (p->size == 8 || (p->size == 9 && !NILP (omit_port))) 1205 else if (size == 8 || (size == 9 && !NILP (omit_port)))
1205 { 1206 {
1206 args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x"); 1207 args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
1207 nargs = 8; 1208 nargs = 8;
1208 } 1209 }
1209 else if (p->size == 9) 1210 else if (size == 9)
1210 { 1211 {
1211 args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d"); 1212 args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
1212 nargs = 9; 1213 nargs = 9;
@@ -2064,13 +2065,13 @@ get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp)
2064 if (VECTORP (address)) 2065 if (VECTORP (address))
2065 { 2066 {
2066 p = XVECTOR (address); 2067 p = XVECTOR (address);
2067 if (p->size == 5) 2068 if (p->header.size == 5)
2068 { 2069 {
2069 *familyp = AF_INET; 2070 *familyp = AF_INET;
2070 return sizeof (struct sockaddr_in); 2071 return sizeof (struct sockaddr_in);
2071 } 2072 }
2072#ifdef AF_INET6 2073#ifdef AF_INET6
2073 else if (p->size == 9) 2074 else if (p->header.size == 9)
2074 { 2075 {
2075 *familyp = AF_INET6; 2076 *familyp = AF_INET6;
2076 return sizeof (struct sockaddr_in6); 2077 return sizeof (struct sockaddr_in6);
@@ -2089,7 +2090,7 @@ get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp)
2089 struct sockaddr *sa; 2090 struct sockaddr *sa;
2090 *familyp = XINT (XCAR (address)); 2091 *familyp = XINT (XCAR (address));
2091 p = XVECTOR (XCDR (address)); 2092 p = XVECTOR (XCDR (address));
2092 return p->size + sizeof (sa->sa_family); 2093 return p->header.size + sizeof (sa->sa_family);
2093 } 2094 }
2094 return 0; 2095 return 0;
2095} 2096}
diff --git a/src/process.h b/src/process.h
index 0348f211bb9..2fca7327a0c 100644
--- a/src/process.h
+++ b/src/process.h
@@ -29,13 +29,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29/* This structure records information about a subprocess 29/* This structure records information about a subprocess
30 or network connection. 30 or network connection.
31 31
32 Every field in this structure except for the first two 32 Every field in this structure except for the header
33 must be a Lisp_Object, for GC's sake. */ 33 must be a Lisp_Object, for GC's sake. */
34 34
35struct Lisp_Process 35struct Lisp_Process
36 { 36 {
37 EMACS_UINT size; 37 struct vector_header header;
38 struct Lisp_Vector *v_next; 38
39 /* Name of subprocess terminal. */ 39 /* Name of subprocess terminal. */
40 Lisp_Object tty_name; 40 Lisp_Object tty_name;
41 /* Name of this process */ 41 /* Name of this process */
diff --git a/src/syntax.c b/src/syntax.c
index 4be6b8db140..6b8e0c72b2b 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -979,7 +979,7 @@ text property. */)
979 break; 979 break;
980 } 980 }
981 981
982 if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match)) 982 if (val < XVECTOR_SIZE (Vsyntax_code_object) && NILP (match))
983 return XVECTOR (Vsyntax_code_object)->contents[val]; 983 return XVECTOR (Vsyntax_code_object)->contents[val];
984 else 984 else
985 /* Since we can't use a shared object, let's make a new one. */ 985 /* Since we can't use a shared object, let's make a new one. */
@@ -3370,7 +3370,7 @@ init_syntax_once (void)
3370 3370
3371 /* Create objects which can be shared among syntax tables. */ 3371 /* Create objects which can be shared among syntax tables. */
3372 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); 3372 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil);
3373 for (i = 0; i < XVECTOR (Vsyntax_code_object)->size; i++) 3373 for (i = 0; i < XVECTOR_SIZE (Vsyntax_code_object); i++)
3374 XVECTOR (Vsyntax_code_object)->contents[i] 3374 XVECTOR (Vsyntax_code_object)->contents[i]
3375 = Fcons (make_number (i), Qnil); 3375 = Fcons (make_number (i), Qnil);
3376 3376
diff --git a/src/termhooks.h b/src/termhooks.h
index c6b1084f347..97dd87b4949 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -322,10 +322,8 @@ struct w32_display_info;
322/* Terminal-local parameters. */ 322/* Terminal-local parameters. */
323struct terminal 323struct terminal
324{ 324{
325 /* The first two fields are really the header of a vector */ 325 /* This is for Lisp; the terminal code does not refer to it. */
326 /* The terminal code does not refer to them. */ 326 struct vector_header header;
327 EMACS_UINT size;
328 struct Lisp_Vector *vec_next;
329 327
330 /* Parameter alist of this terminal. */ 328 /* Parameter alist of this terminal. */
331 Lisp_Object param_alist; 329 Lisp_Object param_alist;
diff --git a/src/w32font.c b/src/w32font.c
index d86107bc6d5..a9fa5256a43 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -165,7 +165,7 @@ intern_font_name (char * string)
165 165
166 /* The following code is copied from the function intern (in lread.c). */ 166 /* The following code is copied from the function intern (in lread.c). */
167 obarray = Vobarray; 167 obarray = Vobarray;
168 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 168 if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
169 obarray = check_obarray (obarray); 169 obarray = check_obarray (obarray);
170 tem = oblookup (obarray, SDATA (str), len, len); 170 tem = oblookup (obarray, SDATA (str), len, len);
171 if (SYMBOLP (tem)) 171 if (SYMBOLP (tem))
@@ -2581,4 +2581,3 @@ versions of Windows) characters. */);
2581 w32font_driver.type = Qgdi; 2581 w32font_driver.type = Qgdi;
2582 register_font_driver (&w32font_driver, NULL); 2582 register_font_driver (&w32font_driver, NULL);
2583} 2583}
2584
diff --git a/src/w32menu.c b/src/w32menu.c
index f092ff87bf2..ef4f8d1485a 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -427,11 +427,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
427 427
428 menu_items = f->menu_bar_vector; 428 menu_items = f->menu_bar_vector;
429 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 429 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
430 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 430 submenu_start = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
431 submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 431 submenu_end = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
432 submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); 432 submenu_n_panes = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int));
433 submenu_top_level_items 433 submenu_top_level_items
434 = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 434 = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
435 init_menu_items (); 435 init_menu_items ();
436 for (i = 0; i < ASIZE (items); i += 4) 436 for (i = 0; i < ASIZE (items); i += 4)
437 { 437 {
diff --git a/src/window.c b/src/window.c
index 5d059535614..92c7c57e213 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5794,8 +5794,7 @@ zero means top of window, negative means relative to bottom of window. */)
5794 5794
5795struct save_window_data 5795struct save_window_data
5796 { 5796 {
5797 EMACS_UINT size; 5797 struct vector_header header;
5798 struct Lisp_Vector *next_from_Lisp_Vector_struct;
5799 Lisp_Object selected_frame; 5798 Lisp_Object selected_frame;
5800 Lisp_Object current_window; 5799 Lisp_Object current_window;
5801 Lisp_Object current_buffer; 5800 Lisp_Object current_buffer;
@@ -5817,10 +5816,7 @@ struct save_window_data
5817/* This is saved as a Lisp_Vector */ 5816/* This is saved as a Lisp_Vector */
5818struct saved_window 5817struct saved_window
5819{ 5818{
5820 /* these first two must agree with struct Lisp_Vector in lisp.h */ 5819 struct vector_header header;
5821 EMACS_UINT size;
5822 struct Lisp_Vector *next_from_Lisp_Vector_struct;
5823
5824 Lisp_Object window; 5820 Lisp_Object window;
5825 Lisp_Object buffer, start, pointm, mark; 5821 Lisp_Object buffer, start, pointm, mark;
5826 Lisp_Object left_col, top_line, total_cols, total_lines; 5822 Lisp_Object left_col, top_line, total_cols, total_lines;
@@ -6001,7 +5997,7 @@ the return value is nil. Otherwise the value is t. */)
6001 dead. */ 5997 dead. */
6002 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); 5998 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f)));
6003 5999
6004 for (k = 0; k < saved_windows->size; k++) 6000 for (k = 0; k < saved_windows->header.size; k++)
6005 { 6001 {
6006 p = SAVED_WINDOW_N (saved_windows, k); 6002 p = SAVED_WINDOW_N (saved_windows, k);
6007 w = XWINDOW (p->window); 6003 w = XWINDOW (p->window);
@@ -6884,10 +6880,10 @@ compare_window_configurations (Lisp_Object c1, Lisp_Object c2, int ignore_positi
6884 return 0; 6880 return 0;
6885 6881
6886 /* Verify that the two confis have the same number of windows. */ 6882 /* Verify that the two confis have the same number of windows. */
6887 if (sw1->size != sw2->size) 6883 if (sw1->header.size != sw2->header.size)
6888 return 0; 6884 return 0;
6889 6885
6890 for (i = 0; i < sw1->size; i++) 6886 for (i = 0; i < sw1->header.size; i++)
6891 { 6887 {
6892 struct saved_window *p1, *p2; 6888 struct saved_window *p1, *p2;
6893 int w1_is_current, w2_is_current; 6889 int w1_is_current, w2_is_current;
diff --git a/src/window.h b/src/window.h
index 65d554a5501..bdbe0e71cc7 100644
--- a/src/window.h
+++ b/src/window.h
@@ -88,10 +88,9 @@ struct cursor_pos
88 88
89struct window 89struct window
90 { 90 {
91 /* The first two fields are really the header of a vector */ 91 /* This is for Lisp; the terminal code does not refer to it. */
92 /* The window code does not refer to them. */ 92 struct vector_header header;
93 EMACS_UINT size; 93
94 struct Lisp_Vector *vec_next;
95 /* The frame this window is on. */ 94 /* The frame this window is on. */
96 Lisp_Object frame; 95 Lisp_Object frame;
97 /* t if this window is a minibuffer window. */ 96 /* t if this window is a minibuffer window. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 19fc36a90a3..63c2e5b8148 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3705,7 +3705,7 @@ setup_for_ellipsis (struct it *it, int len)
3705 { 3705 {
3706 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); 3706 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
3707 it->dpvec = v->contents; 3707 it->dpvec = v->contents;
3708 it->dpend = v->contents + v->size; 3708 it->dpend = v->contents + v->header.size;
3709 } 3709 }
3710 else 3710 else
3711 { 3711 {
@@ -5659,11 +5659,11 @@ get_next_display_element (struct it *it)
5659 /* Return the first character from the display table 5659 /* Return the first character from the display table
5660 entry, if not empty. If empty, don't display the 5660 entry, if not empty. If empty, don't display the
5661 current character. */ 5661 current character. */
5662 if (v->size) 5662 if (v->header.size)
5663 { 5663 {
5664 it->dpvec_char_len = it->len; 5664 it->dpvec_char_len = it->len;
5665 it->dpvec = v->contents; 5665 it->dpvec = v->contents;
5666 it->dpend = v->contents + v->size; 5666 it->dpend = v->contents + v->header.size;
5667 it->current.dpvec_index = 0; 5667 it->current.dpvec_index = 0;
5668 it->dpvec_face_id = -1; 5668 it->dpvec_face_id = -1;
5669 it->saved_face_id = it->face_id; 5669 it->saved_face_id = it->face_id;
@@ -18136,7 +18136,7 @@ display_menu_bar (struct window *w)
18136 18136
18137 /* Display all items of the menu bar. */ 18137 /* Display all items of the menu bar. */
18138 items = FRAME_MENU_BAR_ITEMS (it.f); 18138 items = FRAME_MENU_BAR_ITEMS (it.f);
18139 for (i = 0; i < XVECTOR (items)->size; i += 4) 18139 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
18140 { 18140 {
18141 Lisp_Object string; 18141 Lisp_Object string;
18142 18142
@@ -24828,7 +24828,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
24828 { 24828 {
24829 struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); 24829 struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
24830 Lisp_Object *poly = v->contents; 24830 Lisp_Object *poly = v->contents;
24831 int n = v->size; 24831 int n = v->header.size;
24832 int i; 24832 int i;
24833 int inside = 0; 24833 int inside = 0;
24834 Lisp_Object lx, ly; 24834 Lisp_Object lx, ly;
diff --git a/src/xfaces.c b/src/xfaces.c
index fbed183522a..f20073f6e47 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1848,7 +1848,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1848 1848
1849#define LFACEP(LFACE) \ 1849#define LFACEP(LFACE) \
1850 (VECTORP (LFACE) \ 1850 (VECTORP (LFACE) \
1851 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ 1851 && XVECTOR_SIZE (LFACE) == LFACE_VECTOR_SIZE \
1852 && EQ (AREF (LFACE, 0), Qface)) 1852 && EQ (AREF (LFACE, 0), Qface))
1853#endif 1853#endif
1854 1854
diff --git a/src/xmenu.c b/src/xmenu.c
index 938e5696b21..aac7fd43056 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1011,7 +1011,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1011 1011
1012 menu_items = f->menu_bar_vector; 1012 menu_items = f->menu_bar_vector;
1013 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 1013 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
1014 subitems = XVECTOR (items)->size / 4; 1014 subitems = XVECTOR_SIZE (items) / 4;
1015 submenu_start = (int *) alloca (subitems * sizeof (int *)); 1015 submenu_start = (int *) alloca (subitems * sizeof (int *));
1016 submenu_end = (int *) alloca (subitems * sizeof (int *)); 1016 submenu_end = (int *) alloca (subitems * sizeof (int *));
1017 submenu_n_panes = (int *) alloca (subitems * sizeof (int)); 1017 submenu_n_panes = (int *) alloca (subitems * sizeof (int));
@@ -1097,7 +1097,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1097 /* Now GC cannot happen during the lifetime of the widget_value, 1097 /* Now GC cannot happen during the lifetime of the widget_value,
1098 so it's safe to store data from a Lisp_String. */ 1098 so it's safe to store data from a Lisp_String. */
1099 wv = first_wv->contents; 1099 wv = first_wv->contents;
1100 for (i = 0; i < XVECTOR (items)->size; i += 4) 1100 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
1101 { 1101 {
1102 Lisp_Object string; 1102 Lisp_Object string;
1103 string = XVECTOR (items)->contents[i + 1]; 1103 string = XVECTOR (items)->contents[i + 1];
@@ -1123,7 +1123,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1123 first_wv = wv; 1123 first_wv = wv;
1124 1124
1125 items = FRAME_MENU_BAR_ITEMS (f); 1125 items = FRAME_MENU_BAR_ITEMS (f);
1126 for (i = 0; i < XVECTOR (items)->size; i += 4) 1126 for (i = 0; i < XVECTOR_SIZE (items); i += 4)
1127 { 1127 {
1128 Lisp_Object string; 1128 Lisp_Object string;
1129 1129
diff --git a/src/xselect.c b/src/xselect.c
index db00649f24d..27e2770f8ef 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -423,7 +423,7 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, in
423 int size; 423 int size;
424 int i; 424 int i;
425 pairs = XCDR (target_type); 425 pairs = XCDR (target_type);
426 size = XVECTOR (pairs)->size; 426 size = XVECTOR_SIZE (pairs);
427 /* If the target is MULTIPLE, then target_type looks like 427 /* If the target is MULTIPLE, then target_type looks like
428 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ]) 428 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ])
429 We modify the second element of each pair in the vector and 429 We modify the second element of each pair in the vector and
@@ -1261,12 +1261,12 @@ copy_multiple_data (obj)
1261 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj))); 1261 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
1262 1262
1263 CHECK_VECTOR (obj); 1263 CHECK_VECTOR (obj);
1264 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); 1264 vec = Fmake_vector (size = XVECTOR_SIZE (obj), Qnil);
1265 for (i = 0; i < size; i++) 1265 for (i = 0; i < size; i++)
1266 { 1266 {
1267 Lisp_Object vec2 = XVECTOR (obj)->contents [i]; 1267 Lisp_Object vec2 = XVECTOR (obj)->contents [i];
1268 CHECK_VECTOR (vec2); 1268 CHECK_VECTOR (vec2);
1269 if (XVECTOR (vec2)->size != 2) 1269 if (XVECTOR_SIZE (vec2) != 2)
1270 /* ??? Confusing error message */ 1270 /* ??? Confusing error message */
1271 signal_error ("Vectors must be of length 2", vec2); 1271 signal_error ("Vectors must be of length 2", vec2);
1272 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil); 1272 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil);
@@ -1878,7 +1878,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1878 /* This vector is an ATOM set */ 1878 /* This vector is an ATOM set */
1879 { 1879 {
1880 if (NILP (type)) type = QATOM; 1880 if (NILP (type)) type = QATOM;
1881 *size_ret = XVECTOR (obj)->size; 1881 *size_ret = XVECTOR_SIZE (obj);
1882 *format_ret = 32; 1882 *format_ret = 32;
1883 *data_ret = (unsigned char *) xmalloc ((*size_ret) * sizeof (Atom)); 1883 *data_ret = (unsigned char *) xmalloc ((*size_ret) * sizeof (Atom));
1884 for (i = 0; i < *size_ret; i++) 1884 for (i = 0; i < *size_ret; i++)
@@ -1893,7 +1893,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1893 /* This vector is an ATOM_PAIR set */ 1893 /* This vector is an ATOM_PAIR set */
1894 { 1894 {
1895 if (NILP (type)) type = QATOM_PAIR; 1895 if (NILP (type)) type = QATOM_PAIR;
1896 *size_ret = XVECTOR (obj)->size; 1896 *size_ret = XVECTOR_SIZE (obj);
1897 *format_ret = 32; 1897 *format_ret = 32;
1898 *data_ret = (unsigned char *) 1898 *data_ret = (unsigned char *)
1899 xmalloc ((*size_ret) * sizeof (Atom) * 2); 1899 xmalloc ((*size_ret) * sizeof (Atom) * 2);
@@ -1901,7 +1901,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1901 if (VECTORP (XVECTOR (obj)->contents [i])) 1901 if (VECTORP (XVECTOR (obj)->contents [i]))
1902 { 1902 {
1903 Lisp_Object pair = XVECTOR (obj)->contents [i]; 1903 Lisp_Object pair = XVECTOR (obj)->contents [i];
1904 if (XVECTOR (pair)->size != 2) 1904 if (XVECTOR_SIZE (pair) != 2)
1905 signal_error ( 1905 signal_error (
1906 "Elements of the vector must be vectors of exactly two elements", 1906 "Elements of the vector must be vectors of exactly two elements",
1907 pair); 1907 pair);
@@ -1923,7 +1923,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1923 /* This vector is an INTEGER set, or something like it */ 1923 /* This vector is an INTEGER set, or something like it */
1924 { 1924 {
1925 int data_size = 2; 1925 int data_size = 2;
1926 *size_ret = XVECTOR (obj)->size; 1926 *size_ret = XVECTOR_SIZE (obj);
1927 if (NILP (type)) type = QINTEGER; 1927 if (NILP (type)) type = QINTEGER;
1928 *format_ret = 16; 1928 *format_ret = 16;
1929 for (i = 0; i < *size_ret; i++) 1929 for (i = 0; i < *size_ret; i++)
@@ -1976,7 +1976,7 @@ clean_local_selection_data (Lisp_Object obj)
1976 if (VECTORP (obj)) 1976 if (VECTORP (obj))
1977 { 1977 {
1978 int i; 1978 int i;
1979 int size = XVECTOR (obj)->size; 1979 int size = XVECTOR_SIZE (obj);
1980 Lisp_Object copy; 1980 Lisp_Object copy;
1981 if (size == 1) 1981 if (size == 1)
1982 return clean_local_selection_data (XVECTOR (obj)->contents [0]); 1982 return clean_local_selection_data (XVECTOR (obj)->contents [0]);