aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2013-02-09 00:03:39 +0100
committerJoakim Verona2013-02-09 00:03:39 +0100
commit4df065db6acba3975884b435422773ab97f32a00 (patch)
tree37a7fd1db38463d6de1acd0269588bf5a5ba9ded /src
parente38ad9acca0c806654313993728f9fabd1090f4f (diff)
parent75a65c7eb471bb7c6a5b7dc14a762ff997a5d354 (diff)
downloademacs-4df065db6acba3975884b435422773ab97f32a00.tar.gz
emacs-4df065db6acba3975884b435422773ab97f32a00.zip
auto upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog35
-rw-r--r--src/alloc.c15
-rw-r--r--src/ccl.c3
-rw-r--r--src/charset.c4
-rw-r--r--src/coding.c8
-rw-r--r--src/composite.c2
-rw-r--r--src/doc.c14
-rw-r--r--src/font.c8
-rw-r--r--src/fontset.c5
-rw-r--r--src/ftfont.c3
-rw-r--r--src/indent.c2
-rw-r--r--src/lisp.h21
-rw-r--r--src/lread.c67
-rw-r--r--src/nsselect.m2
-rw-r--r--src/search.c22
-rw-r--r--src/syntax.c11
-rw-r--r--src/w32uniscribe.c4
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xselect.c12
21 files changed, 166 insertions, 92 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9ffe133e758..46f872ba29d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,38 @@
12013-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lread.c (skip_dyn_bytes): New function (bug#12598).
4 (read1): Use it. Use getc instead of READCHAR to read bytes.
5 (load_each_byte): Remove. Update users.
6
72013-02-08 Dmitry Antipov <dmantipov@yandex.ru>
8
9 * search.c (scan_buffer): Calculate end byte position just once.
10 (scan_newline): Do not recalculate start_byte.
11 (search_command): Use eassert.
12 * syntax.c (struct lisp_parse_state): New member location_byte.
13 (scan_sexps_forward): Record from_byte and avoid redundant
14 character to byte position calculation ...
15 (Fparse_partial_sexp): ... here. Break too long line.
16
172013-02-08 Dmitry Antipov <dmantipov@yandex.ru>
18
19 * lisp.h (make_uninit_vector): New function.
20 * alloc.c (Fvector, Fmake_byte_code):
21 * ccl.c (Fregister_ccl_program):
22 * charset.c (Fdefine_charset_internal, define_charset_internal):
23 * coding.c (make_subsidiaries, Fdefine_coding_system_internal):
24 * composite.c (syms_of_composite):
25 * font.c (Fquery_font, Ffont_info, syms_of_font):
26 * fontset.c (FONT_DEF_NEW, Fset_fontset_font):
27 * ftfont.c (ftfont_shape_by_flt):
28 * indent.c (recompute_width_table):
29 * nsselect.m (clean_local_selection_data):
30 * syntax.c (init_syntax_once):
31 * w32unsubscribe.c (uniscribe_shape):
32 * window.c (Fcurrent_window_configuration):
33 * xfaces.c (Fx_family_fonts):
34 * xselect.c (selection_data_to_lisp_data): Use it.
35
12013-02-07 Dmitry Antipov <dmantipov@yandex.ru> 362013-02-07 Dmitry Antipov <dmantipov@yandex.ru>
2 37
3 * coding.c (Fdefine_coding_system_internal): Use AREF where 38 * coding.c (Fdefine_coding_system_internal): Use AREF where
diff --git a/src/alloc.c b/src/alloc.c
index 2624650ed2c..80086433e65 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3105,13 +3105,10 @@ Any number of arguments, even zero arguments, are allowed.
3105usage: (vector &rest OBJECTS) */) 3105usage: (vector &rest OBJECTS) */)
3106 (ptrdiff_t nargs, Lisp_Object *args) 3106 (ptrdiff_t nargs, Lisp_Object *args)
3107{ 3107{
3108 register Lisp_Object len, val;
3109 ptrdiff_t i; 3108 ptrdiff_t i;
3110 register struct Lisp_Vector *p; 3109 register Lisp_Object val = make_uninit_vector (nargs);
3110 register struct Lisp_Vector *p = XVECTOR (val);
3111 3111
3112 XSETFASTINT (len, nargs);
3113 val = Fmake_vector (len, Qnil);
3114 p = XVECTOR (val);
3115 for (i = 0; i < nargs; i++) 3112 for (i = 0; i < nargs; i++)
3116 p->contents[i] = args[i]; 3113 p->contents[i] = args[i];
3117 return val; 3114 return val;
@@ -3149,9 +3146,9 @@ stack before executing the byte-code.
3149usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) 3146usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */)
3150 (ptrdiff_t nargs, Lisp_Object *args) 3147 (ptrdiff_t nargs, Lisp_Object *args)
3151{ 3148{
3152 register Lisp_Object len, val;
3153 ptrdiff_t i; 3149 ptrdiff_t i;
3154 register struct Lisp_Vector *p; 3150 register Lisp_Object val = make_uninit_vector (nargs);
3151 register struct Lisp_Vector *p = XVECTOR (val);
3155 3152
3156 /* We used to purecopy everything here, if purify-flag was set. This worked 3153 /* We used to purecopy everything here, if purify-flag was set. This worked
3157 OK for Emacs-23, but with Emacs-24's lexical binding code, it can be 3154 OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
@@ -3161,10 +3158,6 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3161 just wasteful and other times plainly wrong (e.g. those free vars may want 3158 just wasteful and other times plainly wrong (e.g. those free vars may want
3162 to be setcar'd). */ 3159 to be setcar'd). */
3163 3160
3164 XSETFASTINT (len, nargs);
3165 val = Fmake_vector (len, Qnil);
3166
3167 p = XVECTOR (val);
3168 for (i = 0; i < nargs; i++) 3161 for (i = 0; i < nargs; i++)
3169 p->contents[i] = args[i]; 3162 p->contents[i] = args[i];
3170 make_byte_code (p); 3163 make_byte_code (p);
diff --git a/src/ccl.c b/src/ccl.c
index 9bfd437d885..7f77e1d22fa 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -2228,9 +2228,8 @@ Return index number of the registered CCL program. */)
2228 Vccl_program_table = larger_vector (Vccl_program_table, 1, -1); 2228 Vccl_program_table = larger_vector (Vccl_program_table, 1, -1);
2229 2229
2230 { 2230 {
2231 Lisp_Object elt; 2231 Lisp_Object elt = make_uninit_vector (4);
2232 2232
2233 elt = Fmake_vector (make_number (4), Qnil);
2234 ASET (elt, 0, name); 2233 ASET (elt, 0, name);
2235 ASET (elt, 1, ccl_prog); 2234 ASET (elt, 1, ccl_prog);
2236 ASET (elt, 2, resolved); 2235 ASET (elt, 2, resolved);
diff --git a/src/charset.c b/src/charset.c
index c3a4538f223..fdb8eebde8b 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1053,7 +1053,7 @@ usage: (define-charset-internal ...) */)
1053 CHECK_NATNUM (parent_max_code); 1053 CHECK_NATNUM (parent_max_code);
1054 parent_code_offset = Fnth (make_number (3), val); 1054 parent_code_offset = Fnth (make_number (3), val);
1055 CHECK_NUMBER (parent_code_offset); 1055 CHECK_NUMBER (parent_code_offset);
1056 val = Fmake_vector (make_number (4), Qnil); 1056 val = make_uninit_vector (4);
1057 ASET (val, 0, make_number (parent_charset->id)); 1057 ASET (val, 0, make_number (parent_charset->id));
1058 ASET (val, 1, parent_min_code); 1058 ASET (val, 1, parent_min_code);
1059 ASET (val, 2, parent_max_code); 1059 ASET (val, 2, parent_max_code);
@@ -1259,7 +1259,7 @@ define_charset_internal (Lisp_Object name,
1259 1259
1260 args[charset_arg_name] = name; 1260 args[charset_arg_name] = name;
1261 args[charset_arg_dimension] = make_number (dimension); 1261 args[charset_arg_dimension] = make_number (dimension);
1262 val = Fmake_vector (make_number (8), make_number (0)); 1262 val = make_uninit_vector (8);
1263 for (i = 0; i < 8; i++) 1263 for (i = 0; i < 8; i++)
1264 ASET (val, i, make_number (code_space[i])); 1264 ASET (val, i, make_number (code_space[i]));
1265 args[charset_arg_code_space] = val; 1265 args[charset_arg_code_space] = val;
diff --git a/src/coding.c b/src/coding.c
index c7bfe25e0cc..b881f162ab9 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -9483,7 +9483,7 @@ make_subsidiaries (Lisp_Object base)
9483 int i; 9483 int i;
9484 9484
9485 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); 9485 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
9486 subsidiaries = Fmake_vector (make_number (3), Qnil); 9486 subsidiaries = make_uninit_vector (3);
9487 for (i = 0; i < 3; i++) 9487 for (i = 0; i < 3; i++)
9488 { 9488 {
9489 strcpy (buf + base_name_len, suffixes[i]); 9489 strcpy (buf + base_name_len, suffixes[i]);
@@ -9988,7 +9988,8 @@ usage: (define-coding-system-internal ...) */)
9988 this_name = AREF (eol_type, i); 9988 this_name = AREF (eol_type, i);
9989 this_aliases = Fcons (this_name, Qnil); 9989 this_aliases = Fcons (this_name, Qnil);
9990 this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac); 9990 this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac);
9991 this_spec = Fmake_vector (make_number (3), attrs); 9991 this_spec = make_uninit_vector (3);
9992 ASET (this_spec, 0, attrs);
9992 ASET (this_spec, 1, this_aliases); 9993 ASET (this_spec, 1, this_aliases);
9993 ASET (this_spec, 2, this_eol_type); 9994 ASET (this_spec, 2, this_eol_type);
9994 Fputhash (this_name, this_spec, Vcoding_system_hash_table); 9995 Fputhash (this_name, this_spec, Vcoding_system_hash_table);
@@ -10001,7 +10002,8 @@ usage: (define-coding-system-internal ...) */)
10001 } 10002 }
10002 } 10003 }
10003 10004
10004 spec_vec = Fmake_vector (make_number (3), attrs); 10005 spec_vec = make_uninit_vector (3);
10006 ASET (spec_vec, 0, attrs);
10005 ASET (spec_vec, 1, aliases); 10007 ASET (spec_vec, 1, aliases);
10006 ASET (spec_vec, 2, eol_type); 10008 ASET (spec_vec, 2, eol_type);
10007 10009
diff --git a/src/composite.c b/src/composite.c
index ddd92389725..54cebc00eb7 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1958,7 +1958,7 @@ syms_of_composite (void)
1958 } 1958 }
1959 1959
1960 staticpro (&gstring_work_headers); 1960 staticpro (&gstring_work_headers);
1961 gstring_work_headers = Fmake_vector (make_number (8), Qnil); 1961 gstring_work_headers = make_uninit_vector (8);
1962 for (i = 0; i < 8; i++) 1962 for (i = 0; i < 8; i++)
1963 ASET (gstring_work_headers, i, Fmake_vector (make_number (i + 2), Qnil)); 1963 ASET (gstring_work_headers, i, Fmake_vector (make_number (i + 2), Qnil));
1964 staticpro (&gstring_work); 1964 staticpro (&gstring_work);
diff --git a/src/doc.c b/src/doc.c
index 16c0d4090a0..fa2eca66a1d 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -176,9 +176,9 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
176 if (space_left <= 0) 176 if (space_left <= 0)
177 { 177 {
178 ptrdiff_t in_buffer = p - get_doc_string_buffer; 178 ptrdiff_t in_buffer = p - get_doc_string_buffer;
179 get_doc_string_buffer = 179 get_doc_string_buffer
180 xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size, 180 = xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size,
181 16 * 1024, -1, 1); 181 16 * 1024, -1, 1);
182 p = get_doc_string_buffer + in_buffer; 182 p = get_doc_string_buffer + in_buffer;
183 space_left = (get_doc_string_buffer_size - 1 183 space_left = (get_doc_string_buffer_size - 1
184 - (p - get_doc_string_buffer)); 184 - (p - get_doc_string_buffer));
@@ -279,10 +279,10 @@ Invalid data in documentation file -- %c followed by code %03o",
279 else 279 else
280 { 280 {
281 /* The data determines whether the string is multibyte. */ 281 /* The data determines whether the string is multibyte. */
282 ptrdiff_t nchars = 282 ptrdiff_t nchars
283 multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer 283 = multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer
284 + offset), 284 + offset),
285 to - (get_doc_string_buffer + offset)); 285 to - (get_doc_string_buffer + offset));
286 return make_string_from_bytes (get_doc_string_buffer + offset, 286 return make_string_from_bytes (get_doc_string_buffer + offset,
287 nchars, 287 nchars,
288 to - (get_doc_string_buffer + offset)); 288 to - (get_doc_string_buffer + offset));
diff --git a/src/font.c b/src/font.c
index 3cffe2558ae..bed0ac8caf2 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4603,7 +4603,7 @@ If the font is not OpenType font, CAPABILITY is nil. */)
4603 4603
4604 CHECK_FONT_GET_OBJECT (font_object, font); 4604 CHECK_FONT_GET_OBJECT (font_object, font);
4605 4605
4606 val = Fmake_vector (make_number (9), Qnil); 4606 val = make_uninit_vector (9);
4607 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); 4607 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX));
4608 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); 4608 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX));
4609 ASET (val, 2, make_number (font->pixel_size)); 4609 ASET (val, 2, make_number (font->pixel_size));
@@ -4614,6 +4614,8 @@ If the font is not OpenType font, CAPABILITY is nil. */)
4614 ASET (val, 7, make_number (font->average_width)); 4614 ASET (val, 7, make_number (font->average_width));
4615 if (font->driver->otf_capability) 4615 if (font->driver->otf_capability)
4616 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); 4616 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font)));
4617 else
4618 ASET (val, 8, Qnil);
4617 return val; 4619 return val;
4618} 4620}
4619 4621
@@ -4870,7 +4872,7 @@ If the named font is not yet loaded, return nil. */)
4870 return Qnil; 4872 return Qnil;
4871 font = XFONT_OBJECT (font_object); 4873 font = XFONT_OBJECT (font_object);
4872 4874
4873 info = Fmake_vector (make_number (7), Qnil); 4875 info = make_uninit_vector (7);
4874 ASET (info, 0, AREF (font_object, FONT_NAME_INDEX)); 4876 ASET (info, 0, AREF (font_object, FONT_NAME_INDEX));
4875 ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX)); 4877 ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX));
4876 ASET (info, 2, make_number (font->pixel_size)); 4878 ASET (info, 2, make_number (font->pixel_size));
@@ -5163,7 +5165,7 @@ See `font-weight-table' for the format of the vector. */);
5163 XSYMBOL (intern_c_string ("font-width-table"))->constant = 1; 5165 XSYMBOL (intern_c_string ("font-width-table"))->constant = 1;
5164 5166
5165 staticpro (&font_style_table); 5167 staticpro (&font_style_table);
5166 font_style_table = Fmake_vector (make_number (3), Qnil); 5168 font_style_table = make_uninit_vector (3);
5167 ASET (font_style_table, 0, Vfont_weight_table); 5169 ASET (font_style_table, 0, Vfont_weight_table);
5168 ASET (font_style_table, 1, Vfont_slant_table); 5170 ASET (font_style_table, 1, Vfont_slant_table);
5169 ASET (font_style_table, 2, Vfont_width_table); 5171 ASET (font_style_table, 2, Vfont_width_table);
diff --git a/src/fontset.c b/src/fontset.c
index b7f3e46d69c..3578bc9403d 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -271,7 +271,8 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
271/* Macros for FONT-DEF and RFONT-DEF of fontset. */ 271/* Macros for FONT-DEF and RFONT-DEF of fontset. */
272#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \ 272#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \
273 do { \ 273 do { \
274 (font_def) = Fmake_vector (make_number (3), (font_spec)); \ 274 (font_def) = make_uninit_vector (3); \
275 ASET ((font_def), 0, font_spec); \
275 ASET ((font_def), 1, encoding); \ 276 ASET ((font_def), 1, encoding); \
276 ASET ((font_def), 2, repertory); \ 277 ASET ((font_def), 2, repertory); \
277 } while (0) 278 } while (0)
@@ -1591,7 +1592,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1591 { 1592 {
1592 Lisp_Object arg; 1593 Lisp_Object arg;
1593 1594
1594 arg = Fmake_vector (make_number (5), Qnil); 1595 arg = make_uninit_vector (5);
1595 ASET (arg, 0, fontset); 1596 ASET (arg, 0, fontset);
1596 ASET (arg, 1, font_def); 1597 ASET (arg, 1, font_def);
1597 ASET (arg, 2, add); 1598 ASET (arg, 2, add);
diff --git a/src/ftfont.c b/src/ftfont.c
index 03e40bf2e46..1fb1b574a1c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2555,9 +2555,8 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
2555 LGLYPH_SET_DESCENT (lglyph, g->descent >> 6); 2555 LGLYPH_SET_DESCENT (lglyph, g->descent >> 6);
2556 if (g->adjusted) 2556 if (g->adjusted)
2557 { 2557 {
2558 Lisp_Object vec; 2558 Lisp_Object vec = make_uninit_vector (3);
2559 2559
2560 vec = Fmake_vector (make_number (3), Qnil);
2561 ASET (vec, 0, make_number (g->xoff >> 6)); 2560 ASET (vec, 0, make_number (g->xoff >> 6));
2562 ASET (vec, 1, make_number (g->yoff >> 6)); 2561 ASET (vec, 1, make_number (g->yoff >> 6));
2563 ASET (vec, 2, make_number (g->xadv >> 6)); 2562 ASET (vec, 2, make_number (g->xadv >> 6));
diff --git a/src/indent.c b/src/indent.c
index 45b6afbd395..44ecbbc8a58 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -138,7 +138,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
138 struct Lisp_Vector *widthtab; 138 struct Lisp_Vector *widthtab;
139 139
140 if (!VECTORP (BVAR (buf, width_table))) 140 if (!VECTORP (BVAR (buf, width_table)))
141 bset_width_table (buf, Fmake_vector (make_number (256), make_number (0))); 141 bset_width_table (buf, make_uninit_vector (256));
142 widthtab = XVECTOR (BVAR (buf, width_table)); 142 widthtab = XVECTOR (BVAR (buf, width_table));
143 eassert (widthtab->header.size == 256); 143 eassert (widthtab->header.size == 256);
144 144
diff --git a/src/lisp.h b/src/lisp.h
index dd8d1f38db6..787457b4872 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3048,6 +3048,27 @@ extern void make_byte_code (struct Lisp_Vector *);
3048extern Lisp_Object Qautomatic_gc; 3048extern Lisp_Object Qautomatic_gc;
3049extern Lisp_Object Qchar_table_extra_slots; 3049extern Lisp_Object Qchar_table_extra_slots;
3050extern struct Lisp_Vector *allocate_vector (EMACS_INT); 3050extern struct Lisp_Vector *allocate_vector (EMACS_INT);
3051
3052/* Make an unitialized vector for SIZE objects. NOTE: you must
3053 be sure that GC cannot happen until the vector is completely
3054 initialized. E.g. the following code is likely to crash:
3055
3056 v = make_uninit_vector (3);
3057 ASET (v, 0, obj0);
3058 ASET (v, 1, Ffunction_can_gc ());
3059 ASET (v, 2, obj1); */
3060
3061LISP_INLINE Lisp_Object
3062make_uninit_vector (ptrdiff_t size)
3063{
3064 Lisp_Object v;
3065 struct Lisp_Vector *p;
3066
3067 p = allocate_vector (size);
3068 XSETVECTOR (v, p);
3069 return v;
3070}
3071
3051extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); 3072extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type);
3052#define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ 3073#define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \
3053 ((typ*) \ 3074 ((typ*) \
diff --git a/src/lread.c b/src/lread.c
index 09eccb0fb30..c62c62a5e5a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -96,11 +96,6 @@ static Lisp_Object Qload_in_progress;
96 It must be set to nil before all top-level calls to read0. */ 96 It must be set to nil before all top-level calls to read0. */
97static Lisp_Object read_objects; 97static Lisp_Object read_objects;
98 98
99/* True means READCHAR should read bytes one by one (not character)
100 when READCHARFUN is Qget_file_char or Qget_emacs_mule_file_char.
101 This is set by read1 temporarily while handling #@NUMBER. */
102static bool load_each_byte;
103
104/* List of descriptors now open for Fload. */ 99/* List of descriptors now open for Fload. */
105static Lisp_Object load_descriptor_list; 100static Lisp_Object load_descriptor_list;
106 101
@@ -328,7 +323,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
328 return c; 323 return c;
329 } 324 }
330 c = (*readbyte) (-1, readcharfun); 325 c = (*readbyte) (-1, readcharfun);
331 if (c < 0 || load_each_byte) 326 if (c < 0)
332 return c; 327 return c;
333 if (multibyte) 328 if (multibyte)
334 *multibyte = 1; 329 *multibyte = 1;
@@ -353,6 +348,30 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
353 return STRING_CHAR (buf); 348 return STRING_CHAR (buf);
354} 349}
355 350
351static void
352skip_dyn_bytes (Lisp_Object readcharfun, ptrdiff_t n)
353{
354 if (EQ (readcharfun, Qget_file_char)
355 || EQ (readcharfun, Qget_emacs_mule_file_char))
356 {
357 block_input (); /* FIXME: Not sure if it's needed. */
358 fseek (instream, n, SEEK_CUR);
359 unblock_input ();
360 }
361 else
362 { /* We're not reading directly from a file. In that case, it's difficult
363 to reliably count bytes, since these are usually meant for the file's
364 encoding, whereas we're now typically in the internal encoding.
365 But luckily, skip_dyn_bytes is used to skip over a single
366 dynamic-docstring (or dynamic byte-code) which is always quoted such
367 that \037 is the final char. */
368 int c;
369 do {
370 c = READCHAR;
371 } while (c >= 0 && c != '\037');
372 }
373}
374
356/* Unread the character C in the way appropriate for the stream READCHARFUN. 375/* Unread the character C in the way appropriate for the stream READCHARFUN.
357 If the stream is a user function, call it with the char as argument. */ 376 If the stream is a user function, call it with the char as argument. */
358 377
@@ -407,14 +426,7 @@ unreadchar (Lisp_Object readcharfun, int c)
407 else if (EQ (readcharfun, Qget_file_char) 426 else if (EQ (readcharfun, Qget_file_char)
408 || EQ (readcharfun, Qget_emacs_mule_file_char)) 427 || EQ (readcharfun, Qget_emacs_mule_file_char))
409 { 428 {
410 if (load_each_byte) 429 unread_char = c;
411 {
412 block_input ();
413 ungetc (c, instream);
414 unblock_input ();
415 }
416 else
417 unread_char = c;
418 } 430 }
419 else 431 else
420 call1 (readcharfun, make_number (c)); 432 call1 (readcharfun, make_number (c));
@@ -2388,7 +2400,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2388 bool multibyte; 2400 bool multibyte;
2389 2401
2390 *pch = 0; 2402 *pch = 0;
2391 load_each_byte = 0;
2392 2403
2393 retry: 2404 retry:
2394 2405
@@ -2598,7 +2609,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2598 return tmp; 2609 return tmp;
2599 } 2610 }
2600 2611
2601 /* #@NUMBER is used to skip NUMBER following characters. 2612 /* #@NUMBER is used to skip NUMBER following bytes.
2602 That's used in .elc files to skip over doc strings 2613 That's used in .elc files to skip over doc strings
2603 and function definitions. */ 2614 and function definitions. */
2604 if (c == '@') 2615 if (c == '@')
@@ -2606,7 +2617,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2606 enum { extra = 100 }; 2617 enum { extra = 100 };
2607 ptrdiff_t i, nskip = 0; 2618 ptrdiff_t i, nskip = 0;
2608 2619
2609 load_each_byte = 1;
2610 /* Read a decimal integer. */ 2620 /* Read a decimal integer. */
2611 while ((c = READCHAR) >= 0 2621 while ((c = READCHAR) >= 0
2612 && c >= '0' && c <= '9') 2622 && c >= '0' && c <= '9')
@@ -2616,8 +2626,15 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2616 nskip *= 10; 2626 nskip *= 10;
2617 nskip += c - '0'; 2627 nskip += c - '0';
2618 } 2628 }
2619 UNREAD (c); 2629 if (nskip > 0)
2620 2630 /* We can't use UNREAD here, because in the code below we side-step
2631 READCHAR. Instead, assume the first char after #@NNN occupies
2632 a single byte, which is the case normally since it's just
2633 a space. */
2634 nskip--;
2635 else
2636 UNREAD (c);
2637
2621 if (load_force_doc_strings 2638 if (load_force_doc_strings
2622 && (EQ (readcharfun, Qget_file_char) 2639 && (EQ (readcharfun, Qget_file_char)
2623 || EQ (readcharfun, Qget_emacs_mule_file_char))) 2640 || EQ (readcharfun, Qget_emacs_mule_file_char)))
@@ -2659,19 +2676,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2659 saved_doc_string_position = file_tell (instream); 2676 saved_doc_string_position = file_tell (instream);
2660 2677
2661 /* Copy that many characters into saved_doc_string. */ 2678 /* Copy that many characters into saved_doc_string. */
2679 block_input ();
2662 for (i = 0; i < nskip && c >= 0; i++) 2680 for (i = 0; i < nskip && c >= 0; i++)
2663 saved_doc_string[i] = c = READCHAR; 2681 saved_doc_string[i] = c = getc (instream);
2682 unblock_input ();
2664 2683
2665 saved_doc_string_length = i; 2684 saved_doc_string_length = i;
2666 } 2685 }
2667 else 2686 else
2668 { 2687 /* Skip that many bytes. */
2669 /* Skip that many characters. */ 2688 skip_dyn_bytes (readcharfun, nskip);
2670 for (i = 0; i < nskip && c >= 0; i++)
2671 c = READCHAR;
2672 }
2673 2689
2674 load_each_byte = 0;
2675 goto retry; 2690 goto retry;
2676 } 2691 }
2677 if (c == '!') 2692 if (c == '!')
diff --git a/src/nsselect.m b/src/nsselect.m
index 903448ce0a5..49380f87945 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -117,7 +117,7 @@ clean_local_selection_data (Lisp_Object obj)
117 117
118 if (size == 1) 118 if (size == 1)
119 return clean_local_selection_data (AREF (obj, 0)); 119 return clean_local_selection_data (AREF (obj, 0));
120 copy = Fmake_vector (make_number (size), Qnil); 120 copy = make_uninit_vector (size);
121 for (i = 0; i < size; i++) 121 for (i = 0; i < size; i++)
122 ASET (copy, i, clean_local_selection_data (AREF (obj, i))); 122 ASET (copy, i, clean_local_selection_data (AREF (obj, i)));
123 return copy; 123 return copy;
diff --git a/src/search.c b/src/search.c
index 545f614a063..c4ccf6c257b 100644
--- a/src/search.c
+++ b/src/search.c
@@ -644,18 +644,23 @@ scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
644 ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit) 644 ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit)
645{ 645{
646 struct region_cache *newline_cache; 646 struct region_cache *newline_cache;
647 ptrdiff_t end_byte = -1;
647 int direction; 648 int direction;
648 649
649 if (count > 0) 650 if (count > 0)
650 { 651 {
651 direction = 1; 652 direction = 1;
652 if (! end) end = ZV; 653 if (!end)
654 end = ZV, end_byte = ZV_BYTE;
653 } 655 }
654 else 656 else
655 { 657 {
656 direction = -1; 658 direction = -1;
657 if (! end) end = BEGV; 659 if (!end)
660 end = BEGV, end_byte = BEGV_BYTE;
658 } 661 }
662 if (end_byte == -1)
663 end_byte = CHAR_TO_BYTE (end);
659 664
660 newline_cache_on_off (current_buffer); 665 newline_cache_on_off (current_buffer);
661 newline_cache = current_buffer->newline_cache; 666 newline_cache = current_buffer->newline_cache;
@@ -673,7 +678,7 @@ scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
673 the position of the last character before the next such 678 the position of the last character before the next such
674 obstacle --- the last character the dumb search loop should 679 obstacle --- the last character the dumb search loop should
675 examine. */ 680 examine. */
676 ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end) - 1; 681 ptrdiff_t ceiling_byte = end_byte - 1;
677 ptrdiff_t start_byte; 682 ptrdiff_t start_byte;
678 ptrdiff_t tem; 683 ptrdiff_t tem;
679 684
@@ -750,7 +755,7 @@ scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
750 while (start > end) 755 while (start > end)
751 { 756 {
752 /* The last character to check before the next obstacle. */ 757 /* The last character to check before the next obstacle. */
753 ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end); 758 ptrdiff_t ceiling_byte = end_byte;
754 ptrdiff_t start_byte; 759 ptrdiff_t start_byte;
755 ptrdiff_t tem; 760 ptrdiff_t tem;
756 761
@@ -861,8 +866,6 @@ scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
861 if (allow_quit) 866 if (allow_quit)
862 immediate_quit++; 867 immediate_quit++;
863 868
864 start_byte = CHAR_TO_BYTE (start);
865
866 if (count > 0) 869 if (count > 0)
867 { 870 {
868 while (start_byte < limit_byte) 871 while (start_byte < limit_byte)
@@ -1016,8 +1019,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
1016 1019
1017 if (!EQ (noerror, Qt)) 1020 if (!EQ (noerror, Qt))
1018 { 1021 {
1019 if (lim < BEGV || lim > ZV) 1022 eassert (BEGV <= lim && lim <= ZV);
1020 emacs_abort ();
1021 SET_PT_BOTH (lim, lim_byte); 1023 SET_PT_BOTH (lim, lim_byte);
1022 return Qnil; 1024 return Qnil;
1023#if 0 /* This would be clean, but maybe programs depend on 1025#if 0 /* This would be clean, but maybe programs depend on
@@ -1029,9 +1031,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
1029 return Qnil; 1031 return Qnil;
1030 } 1032 }
1031 1033
1032 if (np < BEGV || np > ZV) 1034 eassert (BEGV <= np && np <= ZV);
1033 emacs_abort ();
1034
1035 SET_PT (np); 1035 SET_PT (np);
1036 1036
1037 return make_number (np); 1037 return make_number (np);
diff --git a/src/syntax.c b/src/syntax.c
index 72d904914ec..42500b0cb76 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -121,6 +121,7 @@ struct lisp_parse_state
121 /* Char number of start of containing expression */ 121 /* Char number of start of containing expression */
122 ptrdiff_t prevlevelstart; 122 ptrdiff_t prevlevelstart;
123 ptrdiff_t location; /* Char number at which parsing stopped. */ 123 ptrdiff_t location; /* Char number at which parsing stopped. */
124 ptrdiff_t location_byte; /* Corresponding byte position. */
124 ptrdiff_t comstr_start; /* Position of last comment/string starter. */ 125 ptrdiff_t comstr_start; /* Position of last comment/string starter. */
125 Lisp_Object levelstarts; /* Char numbers of starts-of-expression 126 Lisp_Object levelstarts; /* Char numbers of starts-of-expression
126 of levels (starting from outermost). */ 127 of levels (starting from outermost). */
@@ -3288,6 +3289,7 @@ do { prev_from = from; \
3288 state.prevlevelstart 3289 state.prevlevelstart
3289 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; 3290 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last;
3290 state.location = from; 3291 state.location = from;
3292 state.location_byte = from_byte;
3291 state.levelstarts = Qnil; 3293 state.levelstarts = Qnil;
3292 while (curlevel > levelstart) 3294 while (curlevel > levelstart)
3293 state.levelstarts = Fcons (make_number ((--curlevel)->last), 3295 state.levelstarts = Fcons (make_number ((--curlevel)->last),
@@ -3327,7 +3329,8 @@ Fifth arg OLDSTATE is a list like what this function returns.
3327Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. 3329Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3328 If it is symbol `syntax-table', stop after the start of a comment or a 3330 If it is symbol `syntax-table', stop after the start of a comment or a
3329 string, or after end of a comment or a string. */) 3331 string, or after end of a comment or a string. */)
3330 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) 3332 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth,
3333 Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop)
3331{ 3334{
3332 struct lisp_parse_state state; 3335 struct lisp_parse_state state;
3333 EMACS_INT target; 3336 EMACS_INT target;
@@ -3347,7 +3350,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3347 (NILP (commentstop) 3350 (NILP (commentstop)
3348 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); 3351 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
3349 3352
3350 SET_PT (state.location); 3353 SET_PT_BOTH (state.location, state.location_byte);
3351 3354
3352 return Fcons (make_number (state.depth), 3355 return Fcons (make_number (state.depth),
3353 Fcons (state.prevlevelstart < 0 3356 Fcons (state.prevlevelstart < 0
@@ -3389,8 +3392,8 @@ init_syntax_once (void)
3389 Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); 3392 Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots");
3390 3393
3391 /* Create objects which can be shared among syntax tables. */ 3394 /* Create objects which can be shared among syntax tables. */
3392 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); 3395 Vsyntax_code_object = make_uninit_vector (Smax);
3393 for (i = 0; i < ASIZE (Vsyntax_code_object); i++) 3396 for (i = 0; i < Smax; i++)
3394 ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil)); 3397 ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil));
3395 3398
3396 /* Now we are ready to set up this property, so we can 3399 /* Now we are ready to set up this property, so we can
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 88227487d35..56931adfac5 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -435,8 +435,8 @@ uniscribe_shape (Lisp_Object lgstring)
435 are zero. */ 435 are zero. */
436 || (!attributes[j].fClusterStart && items[i].a.fRTL)) 436 || (!attributes[j].fClusterStart && items[i].a.fRTL))
437 { 437 {
438 Lisp_Object vec; 438 Lisp_Object vec = make_uninit_vector (3);
439 vec = Fmake_vector (make_number (3), Qnil); 439
440 if (items[i].a.fRTL) 440 if (items[i].a.fRTL)
441 { 441 {
442 /* Empirically, it looks like Uniscribe 442 /* Empirically, it looks like Uniscribe
diff --git a/src/window.c b/src/window.c
index b9165e21d3b..68dcf28f52f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6194,11 +6194,11 @@ saved by this function. */)
6194 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; 6194 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
6195 data->root_window = FRAME_ROOT_WINDOW (f); 6195 data->root_window = FRAME_ROOT_WINDOW (f);
6196 data->focus_frame = FRAME_FOCUS_FRAME (f); 6196 data->focus_frame = FRAME_FOCUS_FRAME (f);
6197 tem = Fmake_vector (make_number (n_windows), Qnil); 6197 tem = make_uninit_vector (n_windows);
6198 data->saved_windows = tem; 6198 data->saved_windows = tem;
6199 for (i = 0; i < n_windows; i++) 6199 for (i = 0; i < n_windows; i++)
6200 ASET (tem, i, 6200 ASET (tem, i,
6201 Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil)); 6201 Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil));
6202 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); 6202 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
6203 XSETWINDOW_CONFIGURATION (tem, data); 6203 XSETWINDOW_CONFIGURATION (tem, data);
6204 return (tem); 6204 return (tem);
diff --git a/src/xdisp.c b/src/xdisp.c
index fe6aa8ad8c3..8a96a3eadc7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21682,11 +21682,15 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21682} 21682}
21683 21683
21684 21684
21685/* Count up to COUNT lines starting from START_BYTE. 21685/* Count up to COUNT lines starting from START_BYTE. COUNT negative
21686 But don't go beyond LIMIT_BYTE. 21686 means count lines back from START_BYTE. But don't go beyond
21687 Return the number of lines thus found (always nonnegative). 21687 LIMIT_BYTE. Return the number of lines thus found (always
21688 21688 nonnegative).
21689 Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ 21689
21690 Set *BYTE_POS_PTR to the byte position where we stopped. This is
21691 either the position COUNT lines after/before START_BYTE, if we
21692 found COUNT lines, or LIMIT_BYTE if we hit the limit before finding
21693 COUNT lines. */
21690 21694
21691static ptrdiff_t 21695static ptrdiff_t
21692display_count_lines (ptrdiff_t start_byte, 21696display_count_lines (ptrdiff_t start_byte,
diff --git a/src/xfaces.c b/src/xfaces.c
index 43535b9ea0c..33a221fdd52 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1585,7 +1585,7 @@ the face font sort order. */)
1585 for (i = nfonts - 1; i >= 0; --i) 1585 for (i = nfonts - 1; i >= 0; --i)
1586 { 1586 {
1587 Lisp_Object font = AREF (vec, i); 1587 Lisp_Object font = AREF (vec, i);
1588 Lisp_Object v = Fmake_vector (make_number (8), Qnil); 1588 Lisp_Object v = make_uninit_vector (8);
1589 int point; 1589 int point;
1590 Lisp_Object spacing; 1590 Lisp_Object spacing;
1591 1591
diff --git a/src/xselect.c b/src/xselect.c
index d769f86cdef..decea696bfd 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1670,8 +1670,8 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1670 return x_atom_to_symbol (display, (Atom) idata[0]); 1670 return x_atom_to_symbol (display, (Atom) idata[0]);
1671 else 1671 else
1672 { 1672 {
1673 Lisp_Object v = Fmake_vector (make_number (size / sizeof (int)), 1673 Lisp_Object v = make_uninit_vector (size / sizeof (int));
1674 make_number (0)); 1674
1675 for (i = 0; i < size / sizeof (int); i++) 1675 for (i = 0; i < size / sizeof (int); i++)
1676 ASET (v, i, x_atom_to_symbol (display, (Atom) idata[i])); 1676 ASET (v, i, x_atom_to_symbol (display, (Atom) idata[i]));
1677 return v; 1677 return v;
@@ -1693,8 +1693,8 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1693 else if (format == 16) 1693 else if (format == 16)
1694 { 1694 {
1695 ptrdiff_t i; 1695 ptrdiff_t i;
1696 Lisp_Object v; 1696 Lisp_Object v = make_uninit_vector (size / 2);
1697 v = Fmake_vector (make_number (size / 2), make_number (0)); 1697
1698 for (i = 0; i < size / 2; i++) 1698 for (i = 0; i < size / 2; i++)
1699 { 1699 {
1700 short j = ((short *) data) [i]; 1700 short j = ((short *) data) [i];
@@ -1705,8 +1705,8 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1705 else 1705 else
1706 { 1706 {
1707 ptrdiff_t i; 1707 ptrdiff_t i;
1708 Lisp_Object v = Fmake_vector (make_number (size / X_LONG_SIZE), 1708 Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE);
1709 make_number (0)); 1709
1710 for (i = 0; i < size / X_LONG_SIZE; i++) 1710 for (i = 0; i < size / X_LONG_SIZE; i++)
1711 { 1711 {
1712 int j = ((int *) data) [i]; 1712 int j = ((int *) data) [i];