comparison src/fns.c @ 81794:c1184a3d99c9

(map_char_table): Use an array of int for `indices' rather than an array of Lisp_Objects (which are only ever integers anyway).
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 10 Jul 2007 15:40:06 +0000
parents f5adf7770714
children 32d8fd242bb2
comparison
equal deleted inserted replaced
81793:935816f951c9 81794:c1184a3d99c9
2823 ARG is passed to C_FUNCTION when that is called. */ 2823 ARG is passed to C_FUNCTION when that is called. */
2824 2824
2825 void 2825 void
2826 map_char_table (c_function, function, table, subtable, arg, depth, indices) 2826 map_char_table (c_function, function, table, subtable, arg, depth, indices)
2827 void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); 2827 void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2828 Lisp_Object function, table, subtable, arg, *indices; 2828 Lisp_Object function, table, subtable, arg;
2829 int depth; 2829 int depth, *indices;
2830 { 2830 {
2831 int i, to; 2831 int i, to;
2832 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 2832 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
2833 2833
2834 GCPRO4 (arg, table, subtable, function); 2834 GCPRO4 (arg, table, subtable, function);
2858 #endif 2858 #endif
2859 to = CHAR_TABLE_ORDINARY_SLOTS; 2859 to = CHAR_TABLE_ORDINARY_SLOTS;
2860 } 2860 }
2861 else 2861 else
2862 { 2862 {
2863 int charset = XFASTINT (indices[0]) - 128; 2863 int charset = indices[0] - 128;
2864 2864
2865 i = 32; 2865 i = 32;
2866 to = SUB_CHAR_TABLE_ORDINARY_SLOTS; 2866 to = SUB_CHAR_TABLE_ORDINARY_SLOTS;
2867 if (CHARSET_CHARS (charset) == 94) 2867 if (CHARSET_CHARS (charset) == 94)
2868 i++, to--; 2868 i++, to--;
2872 { 2872 {
2873 Lisp_Object elt; 2873 Lisp_Object elt;
2874 int charset; 2874 int charset;
2875 2875
2876 elt = XCHAR_TABLE (subtable)->contents[i]; 2876 elt = XCHAR_TABLE (subtable)->contents[i];
2877 XSETFASTINT (indices[depth], i); 2877 indices[depth] = i;
2878 charset = XFASTINT (indices[0]) - 128; 2878 charset = indices[0] - 128;
2879 if (depth == 0 2879 if (depth == 0
2880 && (!CHARSET_DEFINED_P (charset) 2880 && (!CHARSET_DEFINED_P (charset)
2881 || charset == CHARSET_8_BIT_CONTROL 2881 || charset == CHARSET_8_BIT_CONTROL
2882 || charset == CHARSET_8_BIT_GRAPHIC)) 2882 || charset == CHARSET_8_BIT_GRAPHIC))
2883 continue; 2883 continue;
2890 } 2890 }
2891 else 2891 else
2892 { 2892 {
2893 int c1, c2, c; 2893 int c1, c2, c;
2894 2894
2895 c1 = depth >= 1 ? XFASTINT (indices[1]) : 0; 2895 c1 = depth >= 1 ? indices[1] : 0;
2896 c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; 2896 c2 = depth >= 2 ? indices[2] : 0;
2897 c = MAKE_CHAR (charset, c1, c2); 2897 c = MAKE_CHAR (charset, c1, c2);
2898 2898
2899 if (NILP (elt)) 2899 if (NILP (elt))
2900 elt = XCHAR_TABLE (subtable)->defalt; 2900 elt = XCHAR_TABLE (subtable)->defalt;
2901 if (NILP (elt)) 2901 if (NILP (elt))
2925 The key is always a possible IDX argument to `aref'. */) 2925 The key is always a possible IDX argument to `aref'. */)
2926 (function, char_table) 2926 (function, char_table)
2927 Lisp_Object function, char_table; 2927 Lisp_Object function, char_table;
2928 { 2928 {
2929 /* The depth of char table is at most 3. */ 2929 /* The depth of char table is at most 3. */
2930 Lisp_Object indices[3]; 2930 int indices[3];
2931 2931
2932 CHECK_CHAR_TABLE (char_table); 2932 CHECK_CHAR_TABLE (char_table);
2933 2933
2934 /* When Lisp_Object is represented as a union, `call2' cannot directly 2934 /* When Lisp_Object is represented as a union, `call2' cannot directly
2935 be passed to map_char_table because it returns a Lisp_Object rather 2935 be passed to map_char_table because it returns a Lisp_Object rather
2936 than returning nothing. 2936 than returning nothing.
2937 Casting leads to crashes on some architectures. -stef */ 2937 Casting leads to crashes on some architectures. --Stef */
2938 map_char_table (void_call2, Qnil, char_table, char_table, function, 0, indices); 2938 map_char_table (void_call2, Qnil, char_table, char_table, function, 0, indices);
2939 return Qnil; 2939 return Qnil;
2940 } 2940 }
2941 2941
2942 /* Return a value for character C in char-table TABLE. Store the 2942 /* Return a value for character C in char-table TABLE. Store the