]> code.delx.au - gnu-emacs/commitdiff
(Ffind_charset_region): Optimization for unibyte buffer.
authorKenichi Handa <handa@m17n.org>
Tue, 8 Sep 1998 02:01:59 +0000 (02:01 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 8 Sep 1998 02:01:59 +0000 (02:01 +0000)
(Ffind_charset_string): For unibyte string, return (ascii).

src/charset.c

index 55cfe717d3d36afd10a06570e072c60ae81a1f51..9cafe3ebcf811f51f6bd84d75d652235909221de 100644 (file)
@@ -798,6 +798,11 @@ Optional arg TABLE if non-nil is a translation table to look up.")
   from = XFASTINT (beg);
   stop = to = XFASTINT (end);
 
+  if (NILP (current_buffer->enable_multibyte_characters))
+    return (from == to
+           ? Qnil
+           : Fcons (Qascii, Qnil));
+
   if (from < GPT && GPT < to)
     {
       stop = GPT;
@@ -843,7 +848,9 @@ Optional arg TABLE if non-nil is a translation table to look up.")
   CHECK_STRING (str, 0);
 
   if (! STRING_MULTIBYTE (str))
-    return Qnil;
+    return (XSTRING (str)->size == 0
+           ? Qnil
+           : Fcons (Qascii, Qnil));
 
   bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
   find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)),