diff 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
line wrap: on
line diff
--- a/src/chartab.h	Tue May 05 13:12:14 2015 +0900
+++ b/src/chartab.h	Fri May 08 12:47:13 2015 +0100
@@ -140,13 +140,28 @@
 					    int leading_byte,
 					    Ichar c);
 
+#ifdef ERROR_CHECK_TYPES
+DECLARE_INLINE_HEADER (
+Lisp_Object
+get_char_table_1 (Ichar ch, Lisp_Object table, Boolint mirrors_allowed)
+)
+#else
 DECLARE_INLINE_HEADER (
 Lisp_Object
 get_char_table_1 (Ichar ch, Lisp_Object table)
 )
+#endif
 {
   Lisp_Object retval;
   Lisp_Char_Table *ct = XCHAR_TABLE (table);
+
+#ifdef ERROR_CHECK_TYPES
+  if (!mirrors_allowed)
+    {
+      assert (!ct->mirror_table_p);
+    }
+#endif
+
 #ifdef MULE
   if (ch < NUM_ASCII_CHARS)
     retval = ct->ascii[ch];
@@ -168,16 +183,11 @@
 }
 
 #ifdef ERROR_CHECK_TYPES
-DECLARE_INLINE_HEADER (
-Lisp_Object
-get_char_table (Ichar ch, Lisp_Object table)
-)
-{
-  assert (!XCHAR_TABLE (table)->mirror_table_p);
-  return get_char_table_1 (ch, table);
-}
+#define get_char_table(ch, table) get_char_table_1 (ch, table, 0)
+#define get_char_table_mirrors_ok(ch, table) get_char_table_1 (ch, table, 1)
 #else
-#define get_char_table(ch, table) get_char_table_1 (ch, table)
+#define get_char_table get_char_table_1
+#define get_char_mirrors_ok get_char_table_1
 #endif
 
 enum chartab_range_type