aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2020-04-22 19:00:08 -0700
committerPaul Eggert2020-04-22 19:00:58 -0700
commit7b15cc3ebb45e50ac5faf3bbc2a813afffdaa418 (patch)
treec56c6f3936d440cddc6a43dde5ab05a7f2f599e2 /src
parent023ff119fb511e262e7cd64b8abb7482720ac4a6 (diff)
downloademacs-7b15cc3ebb45e50ac5faf3bbc2a813afffdaa418.tar.gz
emacs-7b15cc3ebb45e50ac5faf3bbc2a813afffdaa418.zip
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. */)
2268static char * 2268static char *
2269push_text_char_description (register unsigned int c, register char *p) 2269push_text_char_description (register unsigned int c, register char *p)
2270{ 2270{
2271 if (c >= 0200)
2272 {
2273 *p++ = 'M';
2274 *p++ = '-';
2275 c -= 0200;
2276 }
2277 if (c < 040) 2271 if (c < 040)
2278 { 2272 {
2279 *p++ = '^'; 2273 *p++ = '^';
@@ -2302,23 +2296,22 @@ characters into "C-char", and uses the 2**27 bit for Meta.
2302See Info node `(elisp)Describing Characters' for examples. */) 2296See Info node `(elisp)Describing Characters' for examples. */)
2303 (Lisp_Object character) 2297 (Lisp_Object character)
2304{ 2298{
2305 /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */
2306 char str[6];
2307 int c;
2308
2309 CHECK_CHARACTER (character); 2299 CHECK_CHARACTER (character);
2310 2300
2311 c = XFIXNUM (character); 2301 int c = XFIXNUM (character);
2312 if (!ASCII_CHAR_P (c)) 2302 if (!ASCII_CHAR_P (c))
2313 { 2303 {
2304 char str[MAX_MULTIBYTE_LENGTH];
2314 int len = CHAR_STRING (c, (unsigned char *) str); 2305 int len = CHAR_STRING (c, (unsigned char *) str);
2315 2306
2316 return make_multibyte_string (str, 1, len); 2307 return make_multibyte_string (str, 1, len);
2317 } 2308 }
2318 2309 else
2319 *push_text_char_description (c & 0377, str) = 0; 2310 {
2320 2311 char desc[4];
2321 return build_string (str); 2312 int len = push_text_char_description (c, desc) - desc;
2313 return make_string (desc, len);
2314 }
2322} 2315}
2323 2316
2324static int where_is_preferred_modifier; 2317static int where_is_preferred_modifier;