summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-04-22 19:00:08 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-04-22 19:00:58 -0700
commit7b15cc3ebb45e50ac5faf3bbc2a813afffdaa418 (patch)
treec56c6f3936d440cddc6a43dde5ab05a7f2f599e2 /src
parent023ff119fb511e262e7cd64b8abb7482720ac4a6 (diff)
text-char-description minor cleanup
* src/keymap.c (push_text_char_description): Omit useless code. (Ftext_char_description): Minor code cleanup, inspired by seeing an incorrect comment about MAX_MULTIBYTE_LENGTH’s value.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 51433e2b5ce..d98b27b7a1b 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2268,12 +2268,6 @@ See `text-char-description' for describing character codes. */)
static char *
push_text_char_description (register unsigned int c, register char *p)
{
- if (c >= 0200)
- {
- *p++ = 'M';
- *p++ = '-';
- c -= 0200;
- }
if (c < 040)
{
*p++ = '^';
@@ -2302,23 +2296,22 @@ characters into "C-char", and uses the 2**27 bit for Meta.
See Info node `(elisp)Describing Characters' for examples. */)
(Lisp_Object character)
{
- /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */
- char str[6];
- int c;
-
CHECK_CHARACTER (character);
- c = XFIXNUM (character);
+ int c = XFIXNUM (character);
if (!ASCII_CHAR_P (c))
{
+ char str[MAX_MULTIBYTE_LENGTH];
int len = CHAR_STRING (c, (unsigned char *) str);
return make_multibyte_string (str, 1, len);
}
-
- *push_text_char_description (c & 0377, str) = 0;
-
- return build_string (str);
+ else
+ {
+ char desc[4];
+ int len = push_text_char_description (c, desc) - desc;
+ return make_string (desc, len);
+ }
}
static int where_is_preferred_modifier;