aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog30
-rw-r--r--src/fns.c72
2 files changed, 49 insertions, 53 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b8443f56832..10533c8c7e6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12006-11-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * fns.c: Use AREF/ASIZE macros.
4 (concat): Provide the full ANSI prototype.
5
12006-11-24 Juanma Barranquero <lekktu@gmail.com> 62006-11-24 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix. 8 * buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix.
@@ -42,15 +47,13 @@
42 47
432006-11-19 Andreas Schwab <schwab@gnu.org> 482006-11-19 Andreas Schwab <schwab@gnu.org>
44 49
45 * xfaces.c (Fdisplay_supports_face_attributes_p): Initialize 50 * xfaces.c (Fdisplay_supports_face_attributes_p): Initialize supports.
46 supports.
47 51
48 * xmenu.c (Fx_popup_menu): Initialize selection. 52 * xmenu.c (Fx_popup_menu): Initialize selection.
49 53
502006-11-18 Andreas Schwab <schwab@suse.de> 542006-11-18 Andreas Schwab <schwab@suse.de>
51 55
52 * s/gnu-linux.h (GC_MARK_SECONDARY_STACK): Update call to 56 * s/gnu-linux.h (GC_MARK_SECONDARY_STACK): Update call to mark_memory.
53 mark_memory.
54 57
552006-11-17 Tetsurou Okazaki <okazaki@be.to> (tiny change) 582006-11-17 Tetsurou Okazaki <okazaki@be.to> (tiny change)
56 59
@@ -68,8 +71,7 @@
68 71
692006-11-14 Kenichi Handa <handa@m17n.org> 722006-11-14 Kenichi Handa <handa@m17n.org>
70 73
71 * coding.c (code_convert_region): Initialize 74 * coding.c (code_convert_region): Initialize coding->heading_ascii.
72 coding->heading_ascii.
73 (decode_coding_string, code_convert_region): Likewise. 75 (decode_coding_string, code_convert_region): Likewise.
74 76
752006-11-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 772006-11-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
@@ -166,7 +168,7 @@
166 168
1672006-11-05 Mark Davies <mark@mcs.vuw.ac.nz> (tiny change) 1692006-11-05 Mark Davies <mark@mcs.vuw.ac.nz> (tiny change)
168 170
169 * s/netbsd.h (POSIX_SIGNALS): Defined. 171 * s/netbsd.h (POSIX_SIGNALS): Define.
170 172
1712006-11-05 Martin Rudalics <rudalics@gmx.at> 1732006-11-05 Martin Rudalics <rudalics@gmx.at>
172 174
@@ -199,8 +201,8 @@
199 (unexec_regions_merge): Don't merge if null pages of preceding region 201 (unexec_regions_merge): Don't merge if null pages of preceding region
200 is not too small. Use long format in printf. 202 is not too small. Use long format in printf.
201 (copy_segment, copy_data_segment): Show filesize. 203 (copy_segment, copy_data_segment): Show filesize.
202 (copy_data_segment): Write filesize bytes of region data. Adjust 204 (copy_data_segment): Write filesize bytes of region data.
203 filesize in segment command accordingly. 205 Adjust filesize in segment command accordingly.
204 (dump_it): Use long format in printf. 206 (dump_it): Use long format in printf.
205 207
2062006-11-05 Juanma Barranquero <lekktu@gmail.com> 2082006-11-05 Juanma Barranquero <lekktu@gmail.com>
@@ -299,8 +301,8 @@
299 `swap_nibbles' static const. 301 `swap_nibbles' static const.
300 (atsu_get_text_layout_with_text_ptr): Make variables `lengths', 302 (atsu_get_text_layout_with_text_ptr): Make variables `lengths',
301 `tags', `sizes', `values' static const. 303 `tags', `sizes', `values' static const.
302 (mac_draw_string_common): Make variables `context' static. Make 304 (mac_draw_string_common): Make variables `context' static.
303 variables `tags', `sizes', and `values' static const. 305 Make variables `tags', `sizes', and `values' static const.
304 (pcm_get_status, x_detect_focus_change, x_scroll_bar_handle_click) 306 (pcm_get_status, x_detect_focus_change, x_scroll_bar_handle_click)
305 (xlfdpat_create, xlfdpat_block_match_1, xlfdpat_match) 307 (xlfdpat_create, xlfdpat_block_match_1, xlfdpat_match)
306 (mac_to_x_fontname, parse_x_font_name, add_mac_font_name) 308 (mac_to_x_fontname, parse_x_font_name, add_mac_font_name)
@@ -311,8 +313,8 @@
311 (fn_keycode_to_keycode_table): Make static const. 313 (fn_keycode_to_keycode_table): Make static const.
312 (mac_load_query_font): Make variables `tags', `sizes', `values', 314 (mac_load_query_font): Make variables `tags', `sizes', `values',
313 `types', and `selectors' static const. 315 `types', and `selectors' static const.
314 (mac_handle_command_event, mac_handle_window_event): Make 316 (mac_handle_command_event, mac_handle_window_event):
315 variables `names' and `types' static const. 317 Make variables `names' and `types' static const.
316 (init_command_handler, install_window_handler): Make variables 318 (init_command_handler, install_window_handler): Make variables
317 `specs*' static const. 319 `specs*' static const.
318 (mac_handle_font_event, mac_handle_text_input_event) 320 (mac_handle_font_event, mac_handle_text_input_event)
@@ -404,7 +406,7 @@
4042006-10-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 4062006-10-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
405 407
406 * gtkutil.c (get_utf8_string): Remove warnings with casts. 408 * gtkutil.c (get_utf8_string): Remove warnings with casts.
407 (xg_tool_bar_button_cb): Ditto 409 (xg_tool_bar_button_cb): Ditto.
408 (xg_tool_bar_callback): Ditto. 410 (xg_tool_bar_callback): Ditto.
409 411
4102006-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 4122006-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
diff --git a/src/fns.c b/src/fns.c
index 3aa8cf4f6b4..7100ada4a6a 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -150,7 +150,7 @@ To get the number of bytes, use `string-bytes'. */)
150 if (STRINGP (sequence)) 150 if (STRINGP (sequence))
151 XSETFASTINT (val, SCHARS (sequence)); 151 XSETFASTINT (val, SCHARS (sequence));
152 else if (VECTORP (sequence)) 152 else if (VECTORP (sequence))
153 XSETFASTINT (val, XVECTOR (sequence)->size); 153 XSETFASTINT (val, ASIZE (sequence));
154 else if (SUB_CHAR_TABLE_P (sequence)) 154 else if (SUB_CHAR_TABLE_P (sequence))
155 XSETFASTINT (val, SUB_CHAR_TABLE_ORDINARY_SLOTS); 155 XSETFASTINT (val, SUB_CHAR_TABLE_ORDINARY_SLOTS);
156 else if (CHAR_TABLE_P (sequence)) 156 else if (CHAR_TABLE_P (sequence))
@@ -158,7 +158,7 @@ To get the number of bytes, use `string-bytes'. */)
158 else if (BOOL_VECTOR_P (sequence)) 158 else if (BOOL_VECTOR_P (sequence))
159 XSETFASTINT (val, XBOOL_VECTOR (sequence)->size); 159 XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
160 else if (COMPILEDP (sequence)) 160 else if (COMPILEDP (sequence))
161 XSETFASTINT (val, XVECTOR (sequence)->size & PSEUDOVECTOR_SIZE_MASK); 161 XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
162 else if (CONSP (sequence)) 162 else if (CONSP (sequence))
163 { 163 {
164 i = 0; 164 i = 0;
@@ -391,9 +391,9 @@ Symbols are also allowed; their print names are used instead. */)
391/* "gcc -O3" enables automatic function inlining, which optimizes out 391/* "gcc -O3" enables automatic function inlining, which optimizes out
392 the arguments for the invocations of this function, whereas it 392 the arguments for the invocations of this function, whereas it
393 expects these values on the stack. */ 393 expects these values on the stack. */
394static Lisp_Object concat () __attribute__((noinline)); 394static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)) __attribute__((noinline));
395#else /* !__GNUC__ */ 395#else /* !__GNUC__ */
396static Lisp_Object concat (); 396static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special));
397#endif 397#endif
398 398
399/* ARGSUSED */ 399/* ARGSUSED */
@@ -617,7 +617,7 @@ concat (nargs, args, target_type, last_special)
617 if (VECTORP (this)) 617 if (VECTORP (this))
618 for (i = 0; i < len; i++) 618 for (i = 0; i < len; i++)
619 { 619 {
620 ch = XVECTOR (this)->contents[i]; 620 ch = AREF (this, i);
621 CHECK_NUMBER (ch); 621 CHECK_NUMBER (ch);
622 this_len_byte = CHAR_BYTES (XINT (ch)); 622 this_len_byte = CHAR_BYTES (XINT (ch));
623 result_len_byte += this_len_byte; 623 result_len_byte += this_len_byte;
@@ -770,7 +770,7 @@ concat (nargs, args, target_type, last_special)
770 thisindex++; 770 thisindex++;
771 } 771 }
772 else 772 else
773 elt = XVECTOR (this)->contents[thisindex++]; 773 elt = AREF (this, thisindex++);
774 774
775 /* Store this element into the result. */ 775 /* Store this element into the result. */
776 if (toindex < 0) 776 if (toindex < 0)
@@ -780,7 +780,7 @@ concat (nargs, args, target_type, last_special)
780 tail = XCDR (tail); 780 tail = XCDR (tail);
781 } 781 }
782 else if (VECTORP (val)) 782 else if (VECTORP (val))
783 XVECTOR (val)->contents[toindex++] = elt; 783 AREF (val, toindex++) = elt;
784 else 784 else
785 { 785 {
786 CHECK_NUMBER (elt); 786 CHECK_NUMBER (elt);
@@ -1261,7 +1261,7 @@ This function allows vectors as well as strings. */)
1261 size_byte = SBYTES (string); 1261 size_byte = SBYTES (string);
1262 } 1262 }
1263 else 1263 else
1264 size = XVECTOR (string)->size; 1264 size = ASIZE (string);
1265 1265
1266 if (NILP (to)) 1266 if (NILP (to))
1267 { 1267 {
@@ -1299,8 +1299,7 @@ This function allows vectors as well as strings. */)
1299 string, make_number (0), res, Qnil); 1299 string, make_number (0), res, Qnil);
1300 } 1300 }
1301 else 1301 else
1302 res = Fvector (to_char - from_char, 1302 res = Fvector (to_char - from_char, &AREF (string, from_char));
1303 XVECTOR (string)->contents + from_char);
1304 1303
1305 return res; 1304 return res;
1306} 1305}
@@ -1384,7 +1383,7 @@ substring_both (string, from, from_byte, to, to_byte)
1384 size_byte = SBYTES (string); 1383 size_byte = SBYTES (string);
1385 } 1384 }
1386 else 1385 else
1387 size = XVECTOR (string)->size; 1386 size = ASIZE (string);
1388 1387
1389 if (!(0 <= from && from <= to && to <= size)) 1388 if (!(0 <= from && from <= to && to <= size))
1390 args_out_of_range_3 (string, make_number (from), make_number (to)); 1389 args_out_of_range_3 (string, make_number (from), make_number (to));
@@ -1398,8 +1397,7 @@ substring_both (string, from, from_byte, to, to_byte)
1398 string, make_number (0), res, Qnil); 1397 string, make_number (0), res, Qnil);
1399 } 1398 }
1400 else 1399 else
1401 res = Fvector (to - from, 1400 res = Fvector (to - from, AREF (string, from));
1402 XVECTOR (string)->contents + from);
1403 1401
1404 return res; 1402 return res;
1405} 1403}
@@ -2245,11 +2243,11 @@ internal_equal (o1, o2, depth, props)
2245 case Lisp_Vectorlike: 2243 case Lisp_Vectorlike:
2246 { 2244 {
2247 register int i; 2245 register int i;
2248 EMACS_INT size = XVECTOR (o1)->size; 2246 EMACS_INT size = ASIZE (o1);
2249 /* Pseudovectors have the type encoded in the size field, so this test 2247 /* Pseudovectors have the type encoded in the size field, so this test
2250 actually checks that the objects have the same type as well as the 2248 actually checks that the objects have the same type as well as the
2251 same size. */ 2249 same size. */
2252 if (XVECTOR (o2)->size != size) 2250 if (ASIZE (o2) != size)
2253 return 0; 2251 return 0;
2254 /* Boolvectors are compared much like strings. */ 2252 /* Boolvectors are compared much like strings. */
2255 if (BOOL_VECTOR_P (o1)) 2253 if (BOOL_VECTOR_P (o1))
@@ -2279,8 +2277,8 @@ internal_equal (o1, o2, depth, props)
2279 for (i = 0; i < size; i++) 2277 for (i = 0; i < size; i++)
2280 { 2278 {
2281 Lisp_Object v1, v2; 2279 Lisp_Object v1, v2;
2282 v1 = XVECTOR (o1)->contents [i]; 2280 v1 = AREF (o1, i);
2283 v2 = XVECTOR (o2)->contents [i]; 2281 v2 = AREF (o2, i);
2284 if (!internal_equal (v1, v2, depth + 1, props)) 2282 if (!internal_equal (v1, v2, depth + 1, props))
2285 return 0; 2283 return 0;
2286 } 2284 }
@@ -2321,7 +2319,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2321 if (VECTORP (array)) 2319 if (VECTORP (array))
2322 { 2320 {
2323 register Lisp_Object *p = XVECTOR (array)->contents; 2321 register Lisp_Object *p = XVECTOR (array)->contents;
2324 size = XVECTOR (array)->size; 2322 size = ASIZE (array);
2325 for (index = 0; index < size; index++) 2323 for (index = 0; index < size; index++)
2326 p[index] = item; 2324 p[index] = item;
2327 } 2325 }
@@ -2549,7 +2547,7 @@ Note that this function doesn't check the parent of CHAR-TABLE. */)
2549 2547
2550 charset_info = Fget (range, Qcharset); 2548 charset_info = Fget (range, Qcharset);
2551 CHECK_VECTOR (charset_info); 2549 CHECK_VECTOR (charset_info);
2552 charset_id = XINT (XVECTOR (charset_info)->contents[0]); 2550 charset_id = XINT (AREF (charset_info, 0));
2553 ch = Fmake_char_internal (make_number (charset_id), 2551 ch = Fmake_char_internal (make_number (charset_id),
2554 make_number (0), make_number (0)); 2552 make_number (0), make_number (0));
2555 } 2553 }
@@ -2675,7 +2673,7 @@ character set, or a character code. Return VALUE. */)
2675 Faset (char_table, range, value); 2673 Faset (char_table, range, value);
2676 else if (VECTORP (range)) 2674 else if (VECTORP (range))
2677 { 2675 {
2678 int size = XVECTOR (range)->size; 2676 int size = ASIZE (range);
2679 Lisp_Object *val = XVECTOR (range)->contents; 2677 Lisp_Object *val = XVECTOR (range)->contents;
2680 Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0], 2678 Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0],
2681 size <= 1 ? Qnil : val[1], 2679 size <= 1 ? Qnil : val[1],
@@ -3061,14 +3059,14 @@ mapcar1 (leni, vals, fn, seq)
3061 else 3059 else
3062 GCPRO2 (fn, seq); 3060 GCPRO2 (fn, seq);
3063 /* We need not explicitly protect `tail' because it is used only on lists, and 3061 /* We need not explicitly protect `tail' because it is used only on lists, and
3064 1) lists are not relocated and 2) the list is marked via `seq' so will not be freed */ 3062 1) lists are not relocated and 2) the list is marked via `seq' so will not
3063 be freed */
3065 3064
3066 if (VECTORP (seq)) 3065 if (VECTORP (seq))
3067 { 3066 {
3068 for (i = 0; i < leni; i++) 3067 for (i = 0; i < leni; i++)
3069 { 3068 {
3070 dummy = XVECTOR (seq)->contents[i]; 3069 dummy = call1 (fn, AREF (seq, i));
3071 dummy = call1 (fn, dummy);
3072 if (vals) 3070 if (vals)
3073 vals[i] = dummy; 3071 vals[i] = dummy;
3074 } 3072 }
@@ -3079,11 +3077,7 @@ mapcar1 (leni, vals, fn, seq)
3079 { 3077 {
3080 int byte; 3078 int byte;
3081 byte = XBOOL_VECTOR (seq)->data[i / BOOL_VECTOR_BITS_PER_CHAR]; 3079 byte = XBOOL_VECTOR (seq)->data[i / BOOL_VECTOR_BITS_PER_CHAR];
3082 if (byte & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR))) 3080 dummy = (byte & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR))) ? Qt : Qnil;
3083 dummy = Qt;
3084 else
3085 dummy = Qnil;
3086
3087 dummy = call1 (fn, dummy); 3081 dummy = call1 (fn, dummy);
3088 if (vals) 3082 if (vals)
3089 vals[i] = dummy; 3083 vals[i] = dummy;
@@ -4384,7 +4378,7 @@ larger_vector (vec, new_size, init)
4384 int i, old_size; 4378 int i, old_size;
4385 4379
4386 xassert (VECTORP (vec)); 4380 xassert (VECTORP (vec));
4387 old_size = XVECTOR (vec)->size; 4381 old_size = ASIZE (vec);
4388 xassert (new_size >= old_size); 4382 xassert (new_size >= old_size);
4389 4383
4390 v = allocate_vector (new_size); 4384 v = allocate_vector (new_size);
@@ -4716,7 +4710,7 @@ maybe_resize_hash_table (h)
4716 if (!NILP (HASH_HASH (h, i))) 4710 if (!NILP (HASH_HASH (h, i)))
4717 { 4711 {
4718 unsigned hash_code = XUINT (HASH_HASH (h, i)); 4712 unsigned hash_code = XUINT (HASH_HASH (h, i));
4719 int start_of_bucket = hash_code % XVECTOR (h->index)->size; 4713 int start_of_bucket = hash_code % ASIZE (h->index);
4720 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); 4714 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
4721 HASH_INDEX (h, start_of_bucket) = make_number (i); 4715 HASH_INDEX (h, start_of_bucket) = make_number (i);
4722 } 4716 }
@@ -4742,7 +4736,7 @@ hash_lookup (h, key, hash)
4742 if (hash) 4736 if (hash)
4743 *hash = hash_code; 4737 *hash = hash_code;
4744 4738
4745 start_of_bucket = hash_code % XVECTOR (h->index)->size; 4739 start_of_bucket = hash_code % ASIZE (h->index);
4746 idx = HASH_INDEX (h, start_of_bucket); 4740 idx = HASH_INDEX (h, start_of_bucket);
4747 4741
4748 /* We need not gcpro idx since it's either an integer or nil. */ 4742 /* We need not gcpro idx since it's either an integer or nil. */
@@ -4789,7 +4783,7 @@ hash_put (h, key, value, hash)
4789 HASH_HASH (h, i) = make_number (hash); 4783 HASH_HASH (h, i) = make_number (hash);
4790 4784
4791 /* Add new entry to its collision chain. */ 4785 /* Add new entry to its collision chain. */
4792 start_of_bucket = hash % XVECTOR (h->index)->size; 4786 start_of_bucket = hash % ASIZE (h->index);
4793 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); 4787 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
4794 HASH_INDEX (h, start_of_bucket) = make_number (i); 4788 HASH_INDEX (h, start_of_bucket) = make_number (i);
4795 return i; 4789 return i;
@@ -4808,7 +4802,7 @@ hash_remove (h, key)
4808 Lisp_Object idx, prev; 4802 Lisp_Object idx, prev;
4809 4803
4810 hash_code = h->hashfn (h, key); 4804 hash_code = h->hashfn (h, key);
4811 start_of_bucket = hash_code % XVECTOR (h->index)->size; 4805 start_of_bucket = hash_code % ASIZE (h->index);
4812 idx = HASH_INDEX (h, start_of_bucket); 4806 idx = HASH_INDEX (h, start_of_bucket);
4813 prev = Qnil; 4807 prev = Qnil;
4814 4808
@@ -4864,8 +4858,8 @@ hash_clear (h)
4864 HASH_HASH (h, i) = Qnil; 4858 HASH_HASH (h, i) = Qnil;
4865 } 4859 }
4866 4860
4867 for (i = 0; i < XVECTOR (h->index)->size; ++i) 4861 for (i = 0; i < ASIZE (h->index); ++i)
4868 XVECTOR (h->index)->contents[i] = Qnil; 4862 AREF (h->index, i) = Qnil;
4869 4863
4870 h->next_free = make_number (0); 4864 h->next_free = make_number (0);
4871 h->count = make_number (0); 4865 h->count = make_number (0);
@@ -4890,7 +4884,7 @@ sweep_weak_table (h, remove_entries_p)
4890{ 4884{
4891 int bucket, n, marked; 4885 int bucket, n, marked;
4892 4886
4893 n = XVECTOR (h->index)->size & ~ARRAY_MARK_FLAG; 4887 n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
4894 marked = 0; 4888 marked = 0;
4895 4889
4896 for (bucket = 0; bucket < n; ++bucket) 4890 for (bucket = 0; bucket < n; ++bucket)
@@ -5104,13 +5098,13 @@ sxhash_vector (vec, depth)
5104 Lisp_Object vec; 5098 Lisp_Object vec;
5105 int depth; 5099 int depth;
5106{ 5100{
5107 unsigned hash = XVECTOR (vec)->size; 5101 unsigned hash = ASIZE (vec);
5108 int i, n; 5102 int i, n;
5109 5103
5110 n = min (SXHASH_MAX_LEN, XVECTOR (vec)->size); 5104 n = min (SXHASH_MAX_LEN, ASIZE (vec));
5111 for (i = 0; i < n; ++i) 5105 for (i = 0; i < n; ++i)
5112 { 5106 {
5113 unsigned hash2 = sxhash (XVECTOR (vec)->contents[i], depth + 1); 5107 unsigned hash2 = sxhash (AREF (vec, i), depth + 1);
5114 hash = SXHASH_COMBINE (hash, hash2); 5108 hash = SXHASH_COMBINE (hash, hash2);
5115 } 5109 }
5116 5110