[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7b15cc3 2/2: text-char-description minor cleanup
From: |
Paul Eggert |
Subject: |
master 7b15cc3 2/2: text-char-description minor cleanup |
Date: |
Wed, 22 Apr 2020 22:01:04 -0400 (EDT) |
branch: master
commit 7b15cc3ebb45e50ac5faf3bbc2a813afffdaa418
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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.
---
src/keymap.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/keymap.c b/src/keymap.c
index 51433e2..d98b27b 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;