]> code.delx.au - gnu-emacs/commitdiff
Simplify and cleanup character conversion stuff.
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 23 Jun 2014 04:11:29 +0000 (08:11 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Mon, 23 Jun 2014 04:11:29 +0000 (08:11 +0400)
* lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe):
Remove prototypes.
* character.c (multibyte_char_to_unibyte)
(multibyte_char_to_unibyte_safe): Remove; no longer used.
* character.h (make_char): Remove; unused.
(CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify.
(ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing.
* buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c:
* fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c:
* search.c, term.c, xdisp.c, xterm.c: Related users changed.

20 files changed:
src/ChangeLog
src/buffer.c
src/character.c
src/character.h
src/charset.c
src/charset.h
src/cmds.c
src/coding.c
src/editfns.c
src/fileio.c
src/indent.c
src/insdel.c
src/keyboard.c
src/lisp.h
src/lread.c
src/print.c
src/search.c
src/term.c
src/xdisp.c
src/xterm.c

index fe3a570ee3b8f25c09ff70983e9556f61d5ecb5b..0fc0401265c0bc0154b21dbd49259006d3522b17 100644 (file)
@@ -1,3 +1,17 @@
+2014-06-23  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Simplify and cleanup character conversion stuff.
+       * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe):
+       Remove prototypes.
+       * character.c (multibyte_char_to_unibyte)
+       (multibyte_char_to_unibyte_safe): Remove; no longer used.
+       * character.h (make_char): Remove; unused.
+       (CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify.
+       (ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing.
+       * buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c:
+       * fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c:
+       * search.c, term.c, xdisp.c, xterm.c: Related users changed.
+
 2014-06-22  Mario Lang  <mlang@delysid.org>
 
        * w32fns.c (Fw32_shell_execute): The the -> the.
index 909b3779b063d6ffdb7f005ee7a9dd93b7b5a7f1..d6f6b2c7703f600245232f5c14f0baaa48174cde 100644 (file)
@@ -2530,7 +2530,7 @@ current buffer is cleared.  */)
              p = GAP_END_ADDR;
              stop = Z;
            }
-         if (ASCII_BYTE_P (*p))
+         if (ASCII_CHAR_P (*p))
            p++, pos++;
          else if (CHAR_BYTE8_HEAD_P (*p))
            {
@@ -2602,7 +2602,7 @@ current buffer is cleared.  */)
              stop = Z;
            }
 
-         if (ASCII_BYTE_P (*p))
+         if (ASCII_CHAR_P (*p))
            p++, pos++;
          else if (EQ (flag, Qt)
                   && ! CHAR_BYTE8_HEAD_P (*p)
index 12a95203527a803b82e7462d8a92bcb388d1c1a2..a8e48dfd774231eabd94c3fa7b22054ca1b08745 100644 (file)
@@ -233,32 +233,6 @@ translate_char (Lisp_Object table, int c)
   return c;
 }
 
-/* Convert ASCII or 8-bit character C to unibyte.  If C is none of
-   them, return (C & 0xFF).  */
-
-int
-multibyte_char_to_unibyte (int c)
-{
-  if (c < 0x80)
-    return c;
-  if (CHAR_BYTE8_P (c))
-    return CHAR_TO_BYTE8 (c);
-  return (c & 0xFF);
-}
-
-/* Like multibyte_char_to_unibyte, but return -1 if C is not supported
-   by charset_unibyte.  */
-
-int
-multibyte_char_to_unibyte_safe (int c)
-{
-  if (c < 0x80)
-    return c;
-  if (CHAR_BYTE8_P (c))
-    return CHAR_TO_BYTE8 (c);
-  return -1;
-}
-
 DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0,
        doc: /* Return non-nil if OBJECT is a character.
 In Emacs Lisp, characters are represented by character codes, which
index 6f243a1392d95086e762645d92960219bf467d02..18aad5b8f414cbe346b50c54945840c86ca34685 100644 (file)
@@ -67,20 +67,15 @@ INLINE_HEADER_BEGIN
 #define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00)
 
 #define UNIBYTE_TO_CHAR(byte) \
-  (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte))
+  (ASCII_CHAR_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)            \
-   ? (c) - 0x3FFF00            \
-   : multibyte_char_to_unibyte (c))
+#define CHAR_TO_BYTE8(c) (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : (c & 0xFF))
 
 /* Return the raw 8-bit byte for character C,
    or -1 if C doesn't correspond to a byte.  */
-#define CHAR_TO_BYTE_SAFE(c)   \
-  (CHAR_BYTE8_P (c)            \
-   ? (c) - 0x3FFF00            \
-   : multibyte_char_to_unibyte_safe (c))
+#define CHAR_TO_BYTE_SAFE(c)                                           \
+  (ASCII_CHAR_P (c) ? c : (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : -1))
 
 /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character
    that corresponds to a raw 8-bit byte.  */
@@ -101,13 +96,6 @@ INLINE_HEADER_BEGIN
 /* This is the maximum byte length of multibyte form.  */
 #define MAX_MULTIBYTE_LENGTH 5
 
-/* Return a Lisp character whose character code is C.  Assumes C is
-   a valid character code.  */
-#define make_char(c) make_number (c)
-
-/* Nonzero iff C is an ASCII byte.  */
-#define ASCII_BYTE_P(c) UNSIGNED_CMP (c, <, 0x80)
-
 /* Nonzero iff X is a character.  */
 #define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR)
 
@@ -222,7 +210,7 @@ INLINE_HEADER_BEGIN
 
 /* Nonzero iff BYTE starts a character in a multibyte form.
    This is equivalent to:
-       (ASCII_BYTE_P (byte) || LEADING_CODE_P (byte))  */
+       (ASCII_CHAR_P (byte) || LEADING_CODE_P (byte))  */
 #define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80)
 
 /* How many bytes a character that starts with BYTE occupies in a
index baa692232c792affe1d1560d015e9da06f3ad6e2..341ac356aff2674c71dbd3ab87c6d6d91869f455 100644 (file)
@@ -389,12 +389,12 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
        {
          if (ascii_compatible_p)
            {
-             if (! ASCII_BYTE_P (from_c))
+             if (! ASCII_CHAR_P (from_c))
                {
                  if (from_c < nonascii_min_char)
                    nonascii_min_char = from_c;
                }
-             else if (! ASCII_BYTE_P (to_c))
+             else if (! ASCII_CHAR_P (to_c))
                {
                  nonascii_min_char = 0x80;
                }
@@ -1522,7 +1522,7 @@ find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars,
 
            if (!NILP (table))
              c = translate_char (table, c);
-           if (ASCII_BYTE_P (c))
+           if (ASCII_CHAR_P (c))
              ASET (charsets, charset_ascii, Qt);
            else
              ASET (charsets, charset_eight_bit, Qt);
index 32c624beff8405d122f859719d341a4edc099a5c..4176ce5ecc63d36787552381ea6f9654d41937b4 100644 (file)
@@ -403,7 +403,7 @@ extern Lisp_Object Vchar_charset_set;
    Try some optimization before calling decode_char.  */
 
 #define DECODE_CHAR(charset, code)                                     \
-  ((ASCII_BYTE_P (code) && (charset)->ascii_compatible_p)              \
+  ((ASCII_CHAR_P (code) && (charset)->ascii_compatible_p)              \
    ? (code)                                                            \
    : ((code) < (charset)->min_code || (code) > (charset)->max_code)    \
    ? -1                                                                        \
index 828fea3d7531d73ff34141a277c516114f536213..20234638778ab22a6f722fc7efca2a27fcd193a7 100644 (file)
@@ -359,9 +359,7 @@ internal_self_insert (int c, EMACS_INT n)
     }
   else
     {
-      str[0] = (SINGLE_BYTE_CHAR_P (c)
-               ? c
-               : multibyte_char_to_unibyte (c));
+      str[0] = SINGLE_BYTE_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c);
       len = 1;
     }
   if (!NILP (overwrite)
index fbe14f1695fb439ec7ca74769a936657719cb142..16dc37a3f2072d2767ce216e8e43d3b3bcfc2689 100644 (file)
@@ -1485,7 +1485,7 @@ decode_coding_utf_8 (struct coding_system *coding)
       src = src_base;
       consumed_chars = consumed_chars_base;
       ONE_MORE_BYTE (c);
-      *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c);
+      *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       coding->errors++;
     }
 
@@ -1725,7 +1725,7 @@ decode_coding_utf_16 (struct coding_system *coding)
        ONE_MORE_BYTE (c2);
       if (c2 < 0)
        {
-         *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
+         *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
          *charbuf++ = -c2;
          continue;
        }
@@ -2108,7 +2108,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
 
        case 1:
          code = c;
-         charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit;
+         charset_ID = ASCII_CHAR_P (code) ? charset_ascii : charset_eight_bit;
          break;
 
        default:
@@ -2596,7 +2596,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
       src = src_base;
       consumed_chars = consumed_chars_base;
       ONE_MORE_BYTE (c);
-      *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c);
+      *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
       coding->errors++;
     }
@@ -3573,7 +3573,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
 
       if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0)
        {
-         *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
+         *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
          char_offset++;
          CODING_ISO_EXTSEGMENT_LEN (coding)--;
          continue;
@@ -3600,7 +3600,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
            }
          else
            {
-             *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
+             *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
              char_offset++;
            }
          continue;
@@ -3974,7 +3974,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
          MAYBE_FINISH_COMPOSITION ();
          for (; src_base < src; src_base++, char_offset++)
            {
-             if (ASCII_BYTE_P (*src_base))
+             if (ASCII_CHAR_P (*src_base))
                *charbuf++ = *src_base;
              else
                *charbuf++ = BYTE8_TO_CHAR (*src_base);
@@ -4004,7 +4004,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
       src = src_base;
       consumed_chars = consumed_chars_base;
       ONE_MORE_BYTE (c);
-      *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c);
+      *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
       coding->errors++;
       /* Reset the invocation and designation status to the safest
@@ -5640,7 +5640,7 @@ decode_coding_charset (struct coding_system *coding)
       src = src_base;
       consumed_chars = consumed_chars_base;
       ONE_MORE_BYTE (c);
-      *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c);
+      *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
       coding->errors++;
     }
@@ -9031,13 +9031,13 @@ DEFUN ("find-coding-systems-region-internal",
     p = pbeg = BYTE_POS_ADDR (start_byte);
   pend = p + (end_byte - start_byte);
 
-  while (p < pend && ASCII_BYTE_P (*p)) p++;
-  while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--;
+  while (p < pend && ASCII_CHAR_P (*p)) p++;
+  while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--;
 
   work_table = Fmake_char_table (Qnil, Qnil);
   while (p < pend)
     {
-      if (ASCII_BYTE_P (*p))
+      if (ASCII_CHAR_P (*p))
        p++;
       else
        {
@@ -9169,7 +9169,7 @@ to the string.  */)
       int c;
 
       if (ascii_compatible)
-       while (p < stop && ASCII_BYTE_P (*p))
+       while (p < stop && ASCII_CHAR_P (*p))
          p++, from++;
       if (p >= stop)
        {
@@ -9285,12 +9285,12 @@ is nil.  */)
     p = pbeg = BYTE_POS_ADDR (start_byte);
   pend = p + (end_byte - start_byte);
 
-  while (p < pend && ASCII_BYTE_P (*p)) p++, pos++;
-  while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--;
+  while (p < pend && ASCII_CHAR_P (*p)) p++, pos++;
+  while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--;
 
   while (p < pend)
     {
-      if (ASCII_BYTE_P (*p))
+      if (ASCII_CHAR_P (*p))
        p++;
       else
        {
@@ -9598,7 +9598,7 @@ Return the corresponding character.  */)
   CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
   attrs = AREF (spec, 0);
 
-  if (ASCII_BYTE_P (ch)
+  if (ASCII_CHAR_P (ch)
       && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
     return code;
 
@@ -9679,7 +9679,7 @@ Return the corresponding character.  */)
   CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
   attrs = AREF (spec, 0);
 
-  if (ASCII_BYTE_P (ch)
+  if (ASCII_CHAR_P (ch)
       && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
     return code;
 
index 40fac27ba4714260b96239b31996c414ab15ec62..e8d4478f2f66475f59f99452090de327f4979df0 100644 (file)
@@ -2238,7 +2238,7 @@ general_insert_function (void (*insert_func)
            len = CHAR_STRING (c, str);
          else
            {
-             str[0] = ASCII_CHAR_P (c) ? c : multibyte_char_to_unibyte (c);
+             str[0] = CHAR_TO_BYTE8 (c);
              len = 1;
            }
          (*insert_func) ((char *) str, len);
@@ -2852,7 +2852,7 @@ Both characters must have the same length of multi-byte form.  */)
       len = CHAR_STRING (fromc, fromstr);
       if (CHAR_STRING (toc, tostr) != len)
        error ("Characters in `subst-char-in-region' have different byte-lengths");
-      if (!ASCII_BYTE_P (*tostr))
+      if (!ASCII_CHAR_P (*tostr))
        {
          /* If *TOSTR is in the range 0x80..0x9F and TOCHAR is not a
             complete multibyte character, it may be combined with the
@@ -2945,7 +2945,7 @@ Both characters must have the same length of multi-byte form.  */)
                  : ((pos_byte_next < Z_BYTE
                      && ! CHAR_HEAD_P (FETCH_BYTE (pos_byte_next)))
                     || (pos_byte > BEG_BYTE
-                        && ! ASCII_BYTE_P (FETCH_BYTE (pos_byte - 1))))))
+                        && ! ASCII_CHAR_P (FETCH_BYTE (pos_byte - 1))))))
            {
              Lisp_Object tem, string;
 
@@ -3126,7 +3126,7 @@ It returns the number of characters changed.  */)
              else
                {
                  nc = tt[oc];
-                 if (! ASCII_BYTE_P (nc) && multibyte)
+                 if (! ASCII_CHAR_P (nc) && multibyte)
                    {
                      str_len = BYTE8_STRING (nc, buf);
                      str = buf;
@@ -3877,7 +3877,7 @@ usage: (format STRING &rest OBJECTS)  */)
 
                  if (p > buf
                      && multibyte
-                     && !ASCII_BYTE_P (*((unsigned char *) p - 1))
+                     && !ASCII_CHAR_P (*((unsigned char *) p - 1))
                      && STRING_MULTIBYTE (args[n])
                      && !CHAR_HEAD_P (SREF (args[n], 0)))
                    maybe_combine_byte = 1;
@@ -4167,7 +4167,7 @@ usage: (format STRING &rest OBJECTS)  */)
            {
              /* Copy a whole multibyte character.  */
              if (p > buf
-                 && !ASCII_BYTE_P (*((unsigned char *) p - 1))
+                 && !ASCII_CHAR_P (*((unsigned char *) p - 1))
                  && !CHAR_HEAD_P (*format))
                maybe_combine_byte = 1;
 
@@ -4181,7 +4181,7 @@ usage: (format STRING &rest OBJECTS)  */)
          else
            {
              unsigned char uc = *format++;
-             if (! multibyte || ASCII_BYTE_P (uc))
+             if (! multibyte || ASCII_CHAR_P (uc))
                convbytes = 1;
              else
                {
index c77366612078dcadd8f7352ae256a7069eae4bdd..f0bd75b170efb6e1e63220488c96bd057d7fb10c 100644 (file)
@@ -990,7 +990,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
        {
          unsigned char *p = SDATA (name);
 
-         while (*p && ASCII_BYTE_P (*p))
+         while (*p && ASCII_CHAR_P (*p))
            p++;
          if (*p == '\0')
            {
index 711792f75cd9c5d3520823888cb8114e082ad2a7..79af42c5f7efe03427ce636f93f2958af95140ba 100644 (file)
@@ -920,7 +920,7 @@ position_indentation (ptrdiff_t pos_byte)
          column += tab_width - column % tab_width;
          break;
        default:
-         if (ASCII_BYTE_P (p[-1])
+         if (ASCII_CHAR_P (p[-1])
              || NILP (BVAR (current_buffer, enable_multibyte_characters)))
            return column;
          {
index 2894af753483fdf430b5f5d60e6393fc0aff5ab5..876e2869978a345c873090287623919df1fb9161 100644 (file)
@@ -701,7 +701,7 @@ count_combining_after (const unsigned char *string,
        (2) POS is the last of the current buffer.
        (3) A character at POS can't be a following byte of multibyte
            character.  */
-  if (length > 0 && ASCII_BYTE_P (string[length - 1])) /* case (1) */
+  if (length > 0 && ASCII_CHAR_P (string[length - 1])) /* case (1) */
     return 0;
   if (pos_byte == Z_BYTE)      /* case (2) */
     return 0;
index 1da300b77cc23f70f3fdfebd02c3af7536b336ab..936d6687908dc19476811fef57238e8fdd35e755 100644 (file)
@@ -2084,7 +2084,7 @@ make_ctrl_char (int c)
   /* Save the upper bits here.  */
   int upper = c & ~0177;
 
-  if (! ASCII_BYTE_P (c))
+  if (! ASCII_CHAR_P (c))
     return c |= ctrl_modifier;
 
   c &= 0177;
index 8ad8e80da4bf509446611b4219dbfc162ce74906..0b9d356543397b5eca8c0b50827afdd8b6a8fc84 100644 (file)
@@ -3433,8 +3433,6 @@ extern void syms_of_coding (void);
 /* Defined in character.c.  */
 extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);
 extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t);
-extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST;
-extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST;
 extern void syms_of_character (void);
 
 /* Defined in charset.c.  */
index 41ea1f19227b4067e47ef521e58da5b72e16ee0e..f252993207d42c0e95b3901af15b69fbda85f159 100644 (file)
@@ -213,7 +213,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
       else
        {
          c = BUF_FETCH_BYTE (inbuffer, pt_byte);
-         if (! ASCII_BYTE_P (c))
+         if (! ASCII_CHAR_P (c))
            c = BYTE8_TO_CHAR (c);
          pt_byte++;
        }
@@ -242,7 +242,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
       else
        {
          c = BUF_FETCH_BYTE (inbuffer, bytepos);
-         if (! ASCII_BYTE_P (c))
+         if (! ASCII_CHAR_P (c))
            c = BYTE8_TO_CHAR (c);
          bytepos++;
        }
@@ -324,7 +324,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
     return c;
   if (multibyte)
     *multibyte = 1;
-  if (ASCII_BYTE_P (c))
+  if (ASCII_CHAR_P (c))
     return c;
   if (emacs_mule_encoding)
     return read_emacs_mule_char (c, readbyte, readcharfun);
index 475be9ec28542c213462367dfe43835a90adbb25..9050a0cb7731af4fc804f96fafe1e3745225d475 100644 (file)
@@ -1472,7 +1472,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
                  strout (outbuf, len, len, printcharfun);
                }
              else if (! multibyte
-                      && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c)
+                      && SINGLE_BYTE_CHAR_P (c) && ! ASCII_CHAR_P (c)
                       && print_escape_nonascii)
                {
                  /* When printing in a multibyte buffer
index dc4820d8588860ed6ebf3f0f77afbda6723ad160..ecfb2352144dc4c710a1bbfc4c0c927c89505fa5 100644 (file)
@@ -1416,7 +1416,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
 
                      while (boyer_moore_ok)
                        {
-                         if (ASCII_BYTE_P (inverse))
+                         if (ASCII_CHAR_P (inverse))
                            {
                              if (this_char_base > 0)
                                boyer_moore_ok = 0;
@@ -1827,7 +1827,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
             matching with CHAR_BASE are to be checked.  */
          int ch = -1;
 
-         if (ASCII_BYTE_P (*ptr) || ! multibyte)
+         if (ASCII_CHAR_P (*ptr) || ! multibyte)
            ch = *ptr;
          else if (char_base
                   && ((pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1])))
@@ -2596,7 +2596,7 @@ since only regular expressions have distinguished subexpressions.  */)
            {
              FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte);
              if (!buf_multibyte)
-               c = multibyte_char_to_unibyte (c);
+               c = CHAR_TO_BYTE8 (c);
            }
          else
            {
@@ -2619,7 +2619,7 @@ since only regular expressions have distinguished subexpressions.  */)
                  FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext,
                                                      pos, pos_byte);
                  if (!buf_multibyte && !ASCII_CHAR_P (c))
-                   c = multibyte_char_to_unibyte (c);
+                   c = CHAR_TO_BYTE8 (c);
                }
              else
                {
index 642907979aa7d472d42df93ec0bae7d0a5be0f6f..d4bb7e1bd3228bb1dc45090b78c8c34dc4b4293e 100644 (file)
@@ -1861,7 +1861,7 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
            acronym = XCDR (acronym);
          buf[0] = '[';
          str = STRINGP (acronym) ? SSDATA (acronym) : "";
-         for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)
+         for (len = 0; len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++)
            buf[1 + len] = str[len];
          buf[1 + len] = ']';
          len += 2;
index 8711487780cf914ba712ed7863151d6cacd6eadf..31d293143f34c9d41814ed14e7ecf08c741fafba 100644 (file)
@@ -8269,7 +8269,7 @@ next_element_from_buffer (struct it *it)
 
       /* Get the next character, maybe multibyte.  */
       p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
-      if (it->multibyte_p && !ASCII_BYTE_P (*p))
+      if (it->multibyte_p && !ASCII_CHAR_P (*p))
        it->c = STRING_CHAR_AND_LENGTH (p, it->len);
       else
        it->c = *p, it->len = 1;
@@ -9932,9 +9932,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
          for (i = 0; i < nbytes; i += char_bytes)
            {
              c = string_char_and_length (msg + i, &char_bytes);
-             work[0] = (ASCII_CHAR_P (c)
-                        ? c
-                        : multibyte_char_to_unibyte (c));
+             work[0] = CHAR_TO_BYTE8 (c);
              insert_1_both (work, 1, 1, 1, 0, 0);
            }
        }
@@ -25781,7 +25779,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
          sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c);
          str = buf;
        }
-      for (len = 0; str[len] && ASCII_BYTE_P (str[len]) && len < 6; len++)
+      for (len = 0; str[len] && ASCII_CHAR_P (str[len]) && len < 6; len++)
        code[len] = font->driver->encode_char (font, str[len]);
       upper_len = (len + 1) / 2;
       font->driver->text_extents (font, code, upper_len,
index a7f77bdb282a771c059d10b7370cb3ec5c1472fc..45bb7b2a91851d8996d93f0907493c4f0c2af5f0 100644 (file)
@@ -6460,7 +6460,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
            for (i = 0, nchars = 0; i < nbytes; i++)
              {
-               if (ASCII_BYTE_P (copy_bufptr[i]))
+               if (ASCII_CHAR_P (copy_bufptr[i]))
                  nchars++;
                STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]);
              }