comparison src/editfns.c @ 111756:0e4f6aed76c8

* editfns.c (Fbyte_to_string): Signal an error if arg is not a byte.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 21 Nov 2010 13:16:19 -0500
parents 7a086283ef8c
children 141d3f14d8c3 376148b31b5e
comparison
equal deleted inserted replaced
111755:350f17da7963 111756:0e4f6aed76c8
220 len = CHAR_STRING (XFASTINT (character), str); 220 len = CHAR_STRING (XFASTINT (character), str);
221 return make_string_from_bytes (str, 1, len); 221 return make_string_from_bytes (str, 1, len);
222 } 222 }
223 223
224 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, 224 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
225 doc: /* Convert arg BYTE to a string containing that byte. */) 225 doc: /* Convert arg BYTE to a unibyte string containing that byte. */)
226 (byte) 226 (byte)
227 Lisp_Object byte; 227 Lisp_Object byte;
228 { 228 {
229 unsigned char b; 229 unsigned char b;
230 CHECK_NUMBER (byte); 230 CHECK_NUMBER (byte);
231 if (XINT (byte) < 0 || XINT (byte) > 255)
232 error ("Invalid byte");
231 b = XINT (byte); 233 b = XINT (byte);
232 return make_string_from_bytes (&b, 1, 1); 234 return make_string_from_bytes (&b, 1, 1);
233 } 235 }
234 236
235 DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, 237 DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,