aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-06-05 18:30:59 +0000
committerRichard M. Stallman1994-06-05 18:30:59 +0000
commit4c7d5f1318001326468daa74da971fe5c2941fbe (patch)
tree0ba29fed18d187d73173ba40d4308d3bbf65eea4 /src
parent6cbd1643c9e247a336633df618999bb0904f4880 (diff)
downloademacs-4c7d5f1318001326468daa74da971fe5c2941fbe.tar.gz
emacs-4c7d5f1318001326468daa74da971fe5c2941fbe.zip
(Fkey_description): Avoid using Fmapconcat--do it directly.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 7893c2a054a..0bd1eb6ac98 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1292,10 +1292,14 @@ spaces are put between sequence elements, etc.")
1292 (keys) 1292 (keys)
1293 Lisp_Object keys; 1293 Lisp_Object keys;
1294{ 1294{
1295 int len;
1296 int i;
1297 Lisp_Object sep;
1298 Lisp_Object *args;
1299
1295 if (XTYPE (keys) == Lisp_String) 1300 if (XTYPE (keys) == Lisp_String)
1296 { 1301 {
1297 Lisp_Object vector; 1302 Lisp_Object vector;
1298 int i;
1299 vector = Fmake_vector (Flength (keys), Qnil); 1303 vector = Fmake_vector (Flength (keys), Qnil);
1300 for (i = 0; i < XSTRING (keys)->size; i++) 1304 for (i = 0; i < XSTRING (keys)->size; i++)
1301 { 1305 {
@@ -1308,7 +1312,23 @@ spaces are put between sequence elements, etc.")
1308 } 1312 }
1309 keys = vector; 1313 keys = vector;
1310 } 1314 }
1311 return Fmapconcat (Qsingle_key_description, keys, build_string (" ")); 1315
1316 /* In effect, this computes
1317 (mapconcat 'single-key-description keys " ")
1318 but we shouldn't use mapconcat because it can do GC. */
1319
1320 len = XVECTOR (keys)->size;
1321 sep = build_string (" ");
1322 /* This has one extra element at the end that we don't pass to Fconcat. */
1323 args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object));
1324
1325 for (i = 0; i < len; i++)
1326 {
1327 args[i * 2] = Fsingle_key_description (XVECTOR (keys)->contents[i]);
1328 args[i * 2 + 1] = sep;
1329 }
1330
1331 return Fconcat (len * 2 - 1, args);
1312} 1332}
1313 1333
1314char * 1334char *