aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2014-09-24 15:11:14 +0400
committerDmitry Antipov2014-09-24 15:11:14 +0400
commitc0b1b0371527124f34f505bdac6f2a1cdf8e37b9 (patch)
tree218d6d7a6d64be6019a68ebc19fc2119febe830c /src
parentd4dfe4ea85328f7afd288cd43e141430db33e4e8 (diff)
downloademacs-c0b1b0371527124f34f505bdac6f2a1cdf8e37b9.tar.gz
emacs-c0b1b0371527124f34f505bdac6f2a1cdf8e37b9.zip
* chartab.c (uniprop_encode_value_numeric):
* font.c (font_style_to_value): Use make_local_vector. (font_delete_unmatched): Use local_cons but respect MAX_ALLOCA. * keymap.c (append_key): Use scoped_list1.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/chartab.c9
-rw-r--r--src/font.c16
-rw-r--r--src/keymap.c6
4 files changed, 17 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ca0e9302578..ec4f051f483 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -31,6 +31,11 @@
31 (x_send_scroll_bar_event, xm_scroll_callback, xg_scroll_callback): 31 (x_send_scroll_bar_event, xm_scroll_callback, xg_scroll_callback):
32 Prefer enum and explicit enum members to integers and numeric values. 32 Prefer enum and explicit enum members to integers and numeric values.
33 33
34 * chartab.c (uniprop_encode_value_numeric):
35 * font.c (font_style_to_value): Use make_local_vector.
36 (font_delete_unmatched): Use local_cons but respect MAX_ALLOCA.
37 * keymap.c (append_key): Use scoped_list1.
38
342014-09-24 Paul Eggert <eggert@cs.ucla.edu> 392014-09-24 Paul Eggert <eggert@cs.ucla.edu>
35 40
36 Fix some slow uses and misuses of strcat. 41 Fix some slow uses and misuses of strcat.
diff --git a/src/chartab.c b/src/chartab.c
index 50f76fcf57b..0653783d02a 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1258,13 +1258,8 @@ uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value)
1258 break; 1258 break;
1259 value = make_number (i); 1259 value = make_number (i);
1260 if (i == size) 1260 if (i == size)
1261 { 1261 set_char_table_extras (table, 4, Fvconcat (2, ((Lisp_Object []) {
1262 Lisp_Object args[2]; 1262 XCHAR_TABLE (table)->extras[4], make_local_vector (1, value) })));
1263
1264 args[0] = XCHAR_TABLE (table)->extras[4];
1265 args[1] = Fmake_vector (make_number (1), value);
1266 set_char_table_extras (table, 4, Fvconcat (2, args));
1267 }
1268 return make_number (i); 1263 return make_number (i);
1269} 1264}
1270 1265
diff --git a/src/font.c b/src/font.c
index 1324b6e99c2..496fcd5f1a8 100644
--- a/src/font.c
+++ b/src/font.c
@@ -367,7 +367,7 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val,
367 { 367 {
368 int i, j; 368 int i, j;
369 char *s; 369 char *s;
370 Lisp_Object args[2], elt; 370 Lisp_Object elt;
371 371
372 /* At first try exact match. */ 372 /* At first try exact match. */
373 for (i = 0; i < len; i++) 373 for (i = 0; i < len; i++)
@@ -399,9 +399,9 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val,
399 eassert (len < 255); 399 eassert (len < 255);
400 elt = Fmake_vector (make_number (2), make_number (100)); 400 elt = Fmake_vector (make_number (2), make_number (100));
401 ASET (elt, 1, val); 401 ASET (elt, 1, val);
402 args[0] = table; 402 ASET (font_style_table, prop - FONT_WEIGHT_INDEX,
403 args[1] = Fmake_vector (make_number (1), elt); 403 Fvconcat (2, ((Lisp_Object [])
404 ASET (font_style_table, prop - FONT_WEIGHT_INDEX, Fvconcat (2, args)); 404 { table, make_local_vector (1, elt) })));
405 return (100 << 8) | (i << 4); 405 return (100 << 8) | (i << 4);
406 } 406 }
407 else 407 else
@@ -2685,7 +2685,9 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2685{ 2685{
2686 Lisp_Object entity, val; 2686 Lisp_Object entity, val;
2687 enum font_property_index prop; 2687 enum font_property_index prop;
2688 int i; 2688 /* If USE_STACK_LISP_OBJECTS, MAX is used to avoid unbounded alloca. */
2689 ptrdiff_t i, max
2690 = (USE_STACK_LISP_OBJECTS ? MAX_ALLOCA / sizeof (struct Lisp_Cons) : 0);
2689 2691
2690 for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) 2692 for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--)
2691 { 2693 {
@@ -2713,7 +2715,7 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2713 } 2715 }
2714 if (NILP (spec)) 2716 if (NILP (spec))
2715 { 2717 {
2716 val = Fcons (entity, val); 2718 val = --max > 0 ? local_cons (entity, val) : Fcons (entity, val);
2717 continue; 2719 continue;
2718 } 2720 }
2719 for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) 2721 for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++)
@@ -2744,7 +2746,7 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2744 AREF (entity, FONT_AVGWIDTH_INDEX))) 2746 AREF (entity, FONT_AVGWIDTH_INDEX)))
2745 prop = FONT_SPEC_MAX; 2747 prop = FONT_SPEC_MAX;
2746 if (prop < FONT_SPEC_MAX) 2748 if (prop < FONT_SPEC_MAX)
2747 val = Fcons (entity, val); 2749 val = --max > 0 ? local_cons (entity, val) : Fcons (entity, val);
2748 } 2750 }
2749 return (Fvconcat (1, &val)); 2751 return (Fvconcat (1, &val));
2750} 2752}
diff --git a/src/keymap.c b/src/keymap.c
index a1299ec8554..1d85a403554 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1299,11 +1299,7 @@ define_as_prefix (Lisp_Object keymap, Lisp_Object c)
1299static Lisp_Object 1299static Lisp_Object
1300append_key (Lisp_Object key_sequence, Lisp_Object key) 1300append_key (Lisp_Object key_sequence, Lisp_Object key)
1301{ 1301{
1302 Lisp_Object args[2]; 1302 return Fvconcat (2, ((Lisp_Object []) { key_sequence, scoped_list1 (key) }));
1303
1304 args[0] = key_sequence;
1305 args[1] = list1 (key);
1306 return Fvconcat (2, args);
1307} 1303}
1308 1304
1309/* Given a event type C which is a symbol, 1305/* Given a event type C which is a symbol,