changeset 23650:3cc42e65f25b

(Fstring_to_char): Don't return a multibyte character if STRING is a unibyte string.
author Kenichi Handa <handa@m17n.org>
date Fri, 06 Nov 1998 00:44:16 +0000
parents 9e74943ac418
children dcd6688d67be
files src/editfns.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Fri Nov 06 00:44:16 1998 +0000
+++ b/src/editfns.c	Fri Nov 06 00:44:16 1998 +0000
@@ -154,7 +154,12 @@
   CHECK_STRING (string, 0);
   p = XSTRING (string);
   if (p->size)
-    XSETFASTINT (val, STRING_CHAR (p->data, STRING_BYTES (p)));
+    {
+      if (STRING_MULTIBYTE (string))
+	XSETFASTINT (val, STRING_CHAR (p->data, STRING_BYTES (p)));
+      else
+	XSETFASTINT (val, p->data[0]);
+    }
   else
     XSETFASTINT (val, 0);
   return val;