changeset 23131:f7e486faa1ad

(Fchar_bytes): Now always return 1. (char_bytes): New function.
author Kenichi Handa <handa@m17n.org>
date Fri, 28 Aug 1998 12:22:39 +0000
parents f2cee3bcef78
children 1c8e0e09aea1
files src/charset.c
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/charset.c	Fri Aug 28 12:22:39 1998 +0000
+++ b/src/charset.c	Fri Aug 28 12:22:39 1998 +0000
@@ -1015,29 +1015,39 @@
 }
 
 DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
-  "Return byte length of multi-byte form of CHAR.")
+  "Return 1 regardless of the argument CHAR.
+This is now an obsolte function.  We keep is just for backward compatibility.")
   (ch)
      Lisp_Object ch;
 {
   Lisp_Object val;
-  int bytes;
 
   CHECK_NUMBER (ch, 0);
-  if (COMPOSITE_CHAR_P (XFASTINT (ch)))
+  return make_number (1);
+}
+
+/* Return how many bytes C will occupy in a multibyte buffer.
+   Don't call this function directly, instead use macro CHAR_BYTES.  */
+int
+char_bytes (c)
+     int c;
+{
+  int bytes;
+
+  if (COMPOSITE_CHAR_P (c))
     {
-      unsigned int id = COMPOSITE_CHAR_ID (XFASTINT (ch));
+      unsigned int id = COMPOSITE_CHAR_ID (c);
 
       bytes = (id < n_cmpchars ? cmpchar_table[id]->len : 1);
     }
   else
     {
-      int charset = CHAR_CHARSET (XFASTINT (ch));
+      int charset = CHAR_CHARSET (c);
 
       bytes = CHARSET_DEFINED_P (charset) ? CHARSET_BYTES (charset) : 1;
     }
 
-  XSETFASTINT (val, bytes);
-  return val;
+  return make_number (bytes);
 }
 
 /* Return the width of character of which multi-byte form starts with