]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove leftover table unibyte_to_multibyte_table.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 18 Oct 2009 03:08:32 +0000 (03:08 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 18 Oct 2009 03:08:32 +0000 (03:08 +0000)
* character.c (unibyte_to_multibyte_table): Remove.
(Funibyte_char_to_multibyte): Use MAKE_CHAR_MULTIBYTE.
* charset.c (init_charset_once): Don't init unibyte_to_multibyte_table.
* character.h (UNIBYTE_TO_CHAR): New macro.
(MAKE_CHAR_MULTIBYTE): Use it.
(unibyte_to_multibyte_table, unibyte_char_to_multibyte): Remove.
* xdisp.c (get_next_display_element): USE ASCII_CHAR_P.
(message_dolog, set_message_1):
* search.c (Freplace_match):
* editfns.c (Fcompare_buffer_substrings):
* fns.c (Fcompare_strings): Use MAKE_CHAR_MULTIBYTE.
(concat):
* insdel.c (copy_text, count_size_as_multibyte):
Use ASCII_CHAR_P and BYTE8_TO_CHAR.
* term.c (produce_glyphs):
* syntax.c (skip_chars): Use BYTE8_TO_CHAR.
* regex.c (RE_CHAR_TO_MULTIBYTE):
* cmds.c (internal_self_insert):
* buffer.h (FETCH_CHAR_AS_MULTIBYTE): Use UNIBYTE_TO_CHAR.

15 files changed:
src/ChangeLog
src/buffer.h
src/casefiddle.c
src/character.c
src/character.h
src/charset.c
src/cmds.c
src/editfns.c
src/fns.c
src/insdel.c
src/regex.c
src/search.c
src/syntax.c
src/term.c
src/xdisp.c

index aefe15108bb1af0824db7718a16297649abdaced..06adb2d92c4acf43c38cbbdf7f4293d74d228c55 100644 (file)
@@ -1,5 +1,27 @@
 2009-10-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       Remove leftover table unibyte_to_multibyte_table.
+       * character.c (unibyte_to_multibyte_table): Remove.
+       (Funibyte_char_to_multibyte): Use MAKE_CHAR_MULTIBYTE.
+       * charset.c (init_charset_once): Don't init unibyte_to_multibyte_table.
+       * character.h (UNIBYTE_TO_CHAR): New macro.
+       (MAKE_CHAR_MULTIBYTE): Use it.
+       (unibyte_to_multibyte_table, unibyte_char_to_multibyte): Remove.
+       * xdisp.c (get_next_display_element): USE ASCII_CHAR_P.
+       (message_dolog, set_message_1):
+       * search.c (Freplace_match):
+       * editfns.c (Fcompare_buffer_substrings):
+       * fns.c (Fcompare_strings): Use MAKE_CHAR_MULTIBYTE.
+       (concat):
+       * insdel.c (copy_text, count_size_as_multibyte):
+       Use ASCII_CHAR_P and BYTE8_TO_CHAR.
+       * term.c (produce_glyphs):
+       * syntax.c (skip_chars): Use BYTE8_TO_CHAR.
+       * regex.c (RE_CHAR_TO_MULTIBYTE):
+       * cmds.c (internal_self_insert):
+       * buffer.h (FETCH_CHAR_AS_MULTIBYTE): Use UNIBYTE_TO_CHAR.
+
+
        * cmds.c (internal_self_insert): `c' is already in "multibyte" form.
 
 2009-10-17  Dan Nicolaescu  <dann@ics.uci.edu>
index 7e6e8daeafd2cc048078b2a4259bab8a7521b3b7..2a04f49ea48cc14b48074667b3a877617936ce6e 100644 (file)
@@ -339,7 +339,7 @@ extern unsigned char *_fetch_multibyte_char_p;
 #define FETCH_CHAR_AS_MULTIBYTE(pos)                   \
   (!NILP (current_buffer->enable_multibyte_characters) \
    ? FETCH_MULTIBYTE_CHAR ((pos))                      \
-   : unibyte_to_multibyte_table[(FETCH_BYTE ((pos)))])
+   : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos))))
 
 \f
 /* Macros for accessing a character or byte,
index 7317f61346bb67a1335f416c4a603cbb9df7df4a..f01faa01198e2e8866c56a046110e1cff6e4c755 100644 (file)
@@ -90,7 +90,7 @@ casify_object (flag, obj)
       for (i = 0; i < size; i++)
        {
          c = SREF (obj, i);
-             MAKE_CHAR_MULTIBYTE (c);
+         MAKE_CHAR_MULTIBYTE (c);
          c1 = c;
          if (inword && flag != CASE_CAPITALIZE_UP)
            c = DOWNCASE (c);
index 509a14789ad312f9a71f4c67815963abd8ba603d..e2896444c25d76f51c873c7591434a149a669354 100644 (file)
@@ -86,10 +86,6 @@ Lisp_Object Vscript_representative_chars;
 static Lisp_Object Qchar_script_table;
 
 Lisp_Object Vunicode_category_table;
-
-/* Mapping table from unibyte chars to multibyte chars.  */
-int unibyte_to_multibyte_table[256];
-
 \f
 
 /* If character code C has modifier masks, reflect them to the
@@ -325,8 +321,7 @@ DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte,
   c = XFASTINT (ch);
   if (c >= 0x100)
     error ("Not a unibyte character: %d", c);
-  if (c >= 0x80)
-    c = BYTE8_TO_CHAR (c);
+  MAKE_CHAR_MULTIBYTE (c);
   return make_number (c);
 }
 
index 6f4bcdc6b0287c9265a543e44331b7268d17287b..7b6bcd1a5ae6778e6268bf607fb07d6742b0e476 100644 (file)
@@ -62,6 +62,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Return the character code for raw 8-bit byte BYTE.  */
 #define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00)
 
+#define UNIBYTE_TO_CHAR(byte) \
+  (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte))
+
 /* Return the raw 8-bit byte for character C.  */
 #define CHAR_TO_BYTE8(c)       \
   (CHAR_BYTE8_P (c)            \
@@ -79,14 +82,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    that corresponds to a raw 8-bit byte.  */
 #define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1)
 
-/* Mapping table from unibyte chars to multibyte chars.  */
-extern int unibyte_to_multibyte_table[256];
-
-/* Convert the unibyte character C to the corresponding multibyte
-   character.  If C can't be converted, return C.  */
-#define unibyte_char_to_multibyte(c)   \
-  ((c) < 256 ? unibyte_to_multibyte_table[(c)] : (c))
-
 /* If C is not ASCII, make it unibyte. */
 #define MAKE_CHAR_UNIBYTE(c)   \
   do {                         \
@@ -97,7 +92,7 @@ extern int unibyte_to_multibyte_table[256];
 
 /* If C is not ASCII, make it multibyte.  Assumes C < 256.  */
 #define MAKE_CHAR_MULTIBYTE(c) \
-  (eassert ((c) >= 0 && (c) < 256), (c) = unibyte_to_multibyte_table[(c)])
+  (eassert ((c) >= 0 && (c) < 256), (c) = UNIBYTE_TO_CHAR (c))
 
 /* This is the maximum byte length of multibyte form.  */
 #define MAX_MULTIBYTE_LENGTH 5
index e4195de9ff2ec36ad7b27723c6add1998f5e356e..7ca9240d74f0789ba344a1909d9173ea316a864e 100644 (file)
@@ -2331,11 +2331,6 @@ init_charset_once ()
   charset_jisx0208_1978 = -1;
   charset_jisx0208 = -1;
   charset_ksc5601 = -1;
-
-  for (i = 0; i < 128; i++)
-    unibyte_to_multibyte_table[i] = i;
-  for (; i < 256; i++)
-    unibyte_to_multibyte_table[i] = BYTE8_TO_CHAR (i);
 }
 
 #ifdef emacs
index 9cb287b0296a054af832a9306b9204e6781ade07..19073dccf4a5130df776aad80b651b7f04066fe9 100644 (file)
@@ -503,7 +503,7 @@ internal_self_insert (c, noautofill)
       && PT > BEGV
       && (!NILP (current_buffer->enable_multibyte_characters)
          ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword
-         : (SYNTAX (unibyte_char_to_multibyte (XFASTINT (Fprevious_char ())))
+         : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
             == Sword)))
     {
       int modiff = MODIFF;
index e52c3c2195477a1b01a50da9608b1dbc991bf02f..859e396582466db37d420ac6b6db3c8d52e8fc9d 100644 (file)
@@ -2698,7 +2698,7 @@ determines whether case is significant or ignored.  */)
       else
        {
          c1 = BUF_FETCH_BYTE (bp1, i1);
-         c1 = unibyte_char_to_multibyte (c1);
+         MAKE_CHAR_MULTIBYTE (c1);
          i1++;
        }
 
@@ -2711,7 +2711,7 @@ determines whether case is significant or ignored.  */)
       else
        {
          c2 = BUF_FETCH_BYTE (bp2, i2);
-         c2 = unibyte_char_to_multibyte (c2);
+         MAKE_CHAR_MULTIBYTE (c2);
          i2++;
        }
 
index 7c3e04e818fc42b6334977aa25d635fded07bafc..e1431251e2494edc296a1d0860417a52e51d4aef 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -297,7 +297,7 @@ If string STR1 is greater, the value is a positive number N;
       else
        {
          c1 = SREF (str1, i1++);
-         c1 = unibyte_char_to_multibyte (c1);
+         MAKE_CHAR_MULTIBYTE (c1);
        }
 
       if (STRING_MULTIBYTE (str2))
@@ -305,7 +305,7 @@ If string STR1 is greater, the value is a positive number N;
       else
        {
          c2 = SREF (str2, i2++);
-         c2 = unibyte_char_to_multibyte (c2);
+         MAKE_CHAR_MULTIBYTE (c2);
        }
 
       if (c1 == c2)
@@ -703,10 +703,10 @@ concat (nargs, args, target_type, last_special)
                  {
                    XSETFASTINT (elt, SREF (this, thisindex)); thisindex++;
                    if (some_multibyte
-                       && XINT (elt) >= 0200
+                       && !ASCII_CHAR_P (XINT (elt))
                        && XINT (elt) < 0400)
                      {
-                       c = unibyte_char_to_multibyte (XINT (elt));
+                       c = BYTE8_TO_CHAR (XINT (elt));
                        XSETINT (elt, c);
                      }
                  }
index eaf899c8a0e727c74ee25b03f6910fc59b748ed1..b09bed66d553d82379eba04d673282003fca62ec 100644 (file)
@@ -666,9 +666,9 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
        {
          int c = *from_addr++;
 
-         if (c >= 0200)
+         if (!ASCII_CHAR_P (c))
            {
-             c = unibyte_char_to_multibyte (c);
+             c = BYTE8_TO_CHAR (c);
              to_addr += CHAR_STRING (c, to_addr);
              nbytes--;
            }
@@ -694,11 +694,11 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
     {
       unsigned int c = *ptr++;
 
-      if (c < 0200)
+      if (ASCII_CHAR_P (c))
        outgoing_nbytes++;
       else
        {
-         c = unibyte_char_to_multibyte (c);
+         c = BYTE8_TO_CHAR (c);
          outgoing_nbytes += CHAR_BYTES (c);
        }
     }
index 944ef4e0b665a932a1f580112458af88ff86cc35..0c9e137aca0d50a781c5a8fa3a5ddb92c52131c1 100644 (file)
 # define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) \
   (multibyte ? (STRING_CHAR_AND_LENGTH (p, s, len)) : ((len) = 1, *(p)))
 
-# define RE_CHAR_TO_MULTIBYTE(c) unibyte_to_multibyte_table[(c)]
+# define RE_CHAR_TO_MULTIBYTE(c) UNIBYTE_TO_CHAR (c)
 
 # define RE_CHAR_TO_UNIBYTE(c) CHAR_TO_BYTE_SAFE (c)
 
index 6d2f8cc6dbbc8819a0c8bbd356171e34ac72d907..e6ae4b660b6154d28cc27384e61b732735522eb6 100644 (file)
@@ -2759,7 +2759,7 @@ since only regular expressions have distinguished subexpressions.  */)
              /* Note that we don't have to increment POS.  */
              c = SREF (newtext, pos_byte++);
              if (buf_multibyte)
-               c = unibyte_char_to_multibyte (c);
+               MAKE_CHAR_MULTIBYTE (c);
            }
 
          /* Either set ADD_STUFF and ADD_LEN to the text to put in SUBSTED,
@@ -2781,7 +2781,7 @@ since only regular expressions have distinguished subexpressions.  */)
                {
                  c = SREF (newtext, pos_byte++);
                  if (buf_multibyte)
-                   c = unibyte_char_to_multibyte (c);
+                   MAKE_CHAR_MULTIBYTE (c);
                }
 
              if (c == '&')
index d84e62ea257fbb2ef7efaf0a67be153ef972ef27..3c5a21de5c77df939bb4aa4115491b9856d9d213 100644 (file)
@@ -1555,14 +1555,14 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
          bzero (fastmap + 0200, 0200);
          /* We are sure that this loop stops.  */
          for (i = 0200; ! fastmap2[i]; i++);
-         c = unibyte_char_to_multibyte (i);
+         c = BYTE8_TO_CHAR (i);
          fastmap[CHAR_LEADING_CODE (c)] = 1;
          range_start_byte = i;
          range_start_char = c;
          char_ranges = (int *) alloca (sizeof (int) * 128 * 2);
          for (i = 129; i < 0400; i++)
            {
-             c = unibyte_char_to_multibyte (i);
+             c = BYTE8_TO_CHAR (i);
              fastmap[CHAR_LEADING_CODE (c)] = 1;
              if (i - range_start_byte != c - range_start_char)
                {
index d5855b4cbf6336ed8ae419f46ea0b1ed03f0c76b..9e18df3160ebe5a3a7b5bed4db4bbf681e0dd8de 100644 (file)
@@ -1650,7 +1650,7 @@ produce_glyphs (it)
       if (unibyte_display_via_language_environment
          && (it->c >= 0240))
        {
-         it->char_to_display = unibyte_char_to_multibyte (it->c);
+         it->char_to_display = BYTE8_TO_CHAR (it->c);
          it->pixel_width = CHAR_WIDTH (it->char_to_display);
          it->nglyphs = it->pixel_width;
          if (it->glyph_row)
index 24826fa3b964615be025c030c57aa48f44251548..a750a1b73b5e3315207cc2382d663a991a6ce5c1 100644 (file)
@@ -5716,7 +5716,7 @@ get_next_display_element (it)
            }
 
          if (unibyte_display_via_language_environment
-             && it->c >= 0x80)
+             && !ASCII_CHAR_P (it->c))
            decoded = DECODE_CHAR (unibyte, it->c);
 
          if (it->c >= 0x80 && ! NILP (Vnobreak_char_display))
@@ -7773,7 +7773,7 @@ message_dolog (m, nbytes, nlflag, multibyte)
          for (i = 0; i < nbytes; i++)
            {
              c = msg[i];
-             c = unibyte_char_to_multibyte (c);
+             MAKE_CHAR_MULTIBYTE (c);
              char_bytes = CHAR_STRING (c, str);
              insert_1_both (str, 1, char_bytes, 1, 0, 0);
            }
@@ -9079,7 +9079,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
          for (i = 0; i < nbytes; i++)
            {
              c = msg[i];
-             c = unibyte_char_to_multibyte (c);
+             MAKE_CHAR_MULTIBYTE (c);
              n = CHAR_STRING (c, str);
              insert_1_both (str, 1, n, 1, 0, 0);
            }