diff src/character.h @ 95856:f13a77e0e34f

* character.h (CHAR_TO_BYTE_SAFE): New macro. * character.c (Fmultibyte_char_to_unibyte): Obey the docstring. * regex.c (RE_CHAR_TO_UNIBYTE): Use the new macro. (WEAK_ALIAS): Simplify. * syntax.c (skip_chars): Don't mark non-byte chars in the fastmap when searching a unibyte buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 12 Jun 2008 20:25:47 +0000
parents abcb40dd43a2
children d719efd8c628
line wrap: on
line diff
--- a/src/character.h	Thu Jun 12 17:28:00 2008 +0000
+++ b/src/character.h	Thu Jun 12 20:25:47 2008 +0000
@@ -68,6 +68,13 @@
    ? (c) - 0x3FFF00		\
    : multibyte_char_to_unibyte (c, Qnil))
 
+/* 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, Qnil))
+
 /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character
    that corresponds to a raw 8-bit byte.  */
 #define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1)