* character.c (Funibyte_string): Use CHECK_RANGED_INTEGER instead.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Oct 2011 23:16:02 +0000 (16:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Oct 2011 23:16:02 +0000 (16:16 -0700)
src/ChangeLog
src/character.c

index 5b41db9..46c22ca 100644 (file)
        (str_as_unibyte, str_to_unibyte, string_count_byte8)
        (string_escape_byte8, Fget_byte):
        Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
-       (Funibyte_string): Use CHECK_CHARACTER, not CHECK_NATNUM, to
+       (Funibyte_string): Use CHECK_RANGED_INTEGER, not CHECK_NATNUM, to
        avoid mishandling large integers.
        * character.h: Adjust decls to match defn changes elsewhere.
        * charset.c (load_charset_map_from_file, find_charsets_in_text)
index 1e8c75d..3517dbb 100644 (file)
@@ -924,7 +924,6 @@ usage: (unibyte-string &rest BYTES)  */)
   (ptrdiff_t n, Lisp_Object *args)
 {
   ptrdiff_t i;
-  int c;
   unsigned char *buf, *p;
   Lisp_Object str;
   USE_SAFE_ALLOCA;
@@ -934,11 +933,8 @@ usage: (unibyte-string &rest BYTES)  */)
 
   for (i = 0; i < n; i++)
     {
-      CHECK_CHARACTER (args[i]);
-      c = XFASTINT (args[i]);
-      if (c >= 256)
-       args_out_of_range_3 (args[i], make_number (0), make_number (255));
-      *p++ = c;
+      CHECK_RANGED_INTEGER (0, args[i], 255);
+      *p++ = XINT (args[i]);
     }
 
   str = make_string_from_bytes ((char *) buf, n, p - buf);