Simplify string-to-char
* src/editfns.c (Fstring_to_char): Simplify. * src/editfns.c (Fstring_to_char): Simplify. This tweak improved the CPU time performance of ‘make compile-always’ by about 1.8% on my platform.
This commit is contained in:
parent
ed2def7d5e
commit
08408b13fa
1 changed files with 6 additions and 12 deletions
|
@ -162,20 +162,14 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
|
|||
|
||||
DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
|
||||
doc: /* Return the first character in STRING. */)
|
||||
(register Lisp_Object string)
|
||||
(Lisp_Object string)
|
||||
{
|
||||
register Lisp_Object val;
|
||||
CHECK_STRING (string);
|
||||
if (SCHARS (string))
|
||||
{
|
||||
if (STRING_MULTIBYTE (string))
|
||||
XSETFASTINT (val, STRING_CHAR (SDATA (string)));
|
||||
else
|
||||
XSETFASTINT (val, SREF (string, 0));
|
||||
}
|
||||
else
|
||||
XSETFASTINT (val, 0);
|
||||
return val;
|
||||
|
||||
/* This returns zero if STRING is empty. */
|
||||
return make_fixnum (STRING_MULTIBYTE (string)
|
||||
? STRING_CHAR (SDATA (string))
|
||||
: SREF (string, 0));
|
||||
}
|
||||
|
||||
DEFUN ("point", Fpoint, Spoint, 0, 0, 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue