comparison src/chartab.h @ 5902:2dc8711af537

Make get_char_table in loop bodies more tolerable without optimization. 2015-05-08 Aidan Kehoe <kehoea@parhasard.net> * chartab.h (get_char_table): * chartab.h (get_char_table_mirrors_ok): New. Provide get_char_table_mirrors_ok, which differs from get_char_table only if ERROR_CHECK_TYPES is defined. Implement it, and get_char_table, using a macro wrapper of get_char_table_1, so that on builds without optimization each get_char_table no longer requires two C function calls. * chartab.c (updating_mirror_get_range_char_table): Use get_char_table_mirrors_ok. * syntax.h: Ditto.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 08 May 2015 12:47:13 +0100
parents 308d34e9f07d
children 4d5a5a80aba2
comparison
equal deleted inserted replaced
5901:a485caa1131d 5902:2dc8711af537
138 138
139 Lisp_Object get_non_ascii_char_table_value (Lisp_Char_Table *ct, 139 Lisp_Object get_non_ascii_char_table_value (Lisp_Char_Table *ct,
140 int leading_byte, 140 int leading_byte,
141 Ichar c); 141 Ichar c);
142 142
143 #ifdef ERROR_CHECK_TYPES
144 DECLARE_INLINE_HEADER (
145 Lisp_Object
146 get_char_table_1 (Ichar ch, Lisp_Object table, Boolint mirrors_allowed)
147 )
148 #else
143 DECLARE_INLINE_HEADER ( 149 DECLARE_INLINE_HEADER (
144 Lisp_Object 150 Lisp_Object
145 get_char_table_1 (Ichar ch, Lisp_Object table) 151 get_char_table_1 (Ichar ch, Lisp_Object table)
146 ) 152 )
153 #endif
147 { 154 {
148 Lisp_Object retval; 155 Lisp_Object retval;
149 Lisp_Char_Table *ct = XCHAR_TABLE (table); 156 Lisp_Char_Table *ct = XCHAR_TABLE (table);
157
158 #ifdef ERROR_CHECK_TYPES
159 if (!mirrors_allowed)
160 {
161 assert (!ct->mirror_table_p);
162 }
163 #endif
164
150 #ifdef MULE 165 #ifdef MULE
151 if (ch < NUM_ASCII_CHARS) 166 if (ch < NUM_ASCII_CHARS)
152 retval = ct->ascii[ch]; 167 retval = ct->ascii[ch];
153 else 168 else
154 { 169 {
166 else 181 else
167 return ct->default_; 182 return ct->default_;
168 } 183 }
169 184
170 #ifdef ERROR_CHECK_TYPES 185 #ifdef ERROR_CHECK_TYPES
171 DECLARE_INLINE_HEADER ( 186 #define get_char_table(ch, table) get_char_table_1 (ch, table, 0)
172 Lisp_Object 187 #define get_char_table_mirrors_ok(ch, table) get_char_table_1 (ch, table, 1)
173 get_char_table (Ichar ch, Lisp_Object table) 188 #else
174 ) 189 #define get_char_table get_char_table_1
175 { 190 #define get_char_mirrors_ok get_char_table_1
176 assert (!XCHAR_TABLE (table)->mirror_table_p);
177 return get_char_table_1 (ch, table);
178 }
179 #else
180 #define get_char_table(ch, table) get_char_table_1 (ch, table)
181 #endif 191 #endif
182 192
183 enum chartab_range_type 193 enum chartab_range_type
184 { 194 {
185 CHARTAB_RANGE_ALL, 195 CHARTAB_RANGE_ALL,