From: Dmitry Antipov Date: Wed, 24 Sep 2014 11:11:14 +0000 (+0400) Subject: * chartab.c (uniprop_encode_value_numeric): X-Git-Tag: emacs-25.0.90~2635^2~679^2~237 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0b1b0371527124f34f505bdac6f2a1cdf8e37b9;p=emacs.git * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index ca0e9302578..ec4f051f483 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -31,6 +31,11 @@ (x_send_scroll_bar_event, xm_scroll_callback, xg_scroll_callback): Prefer enum and explicit enum members to integers and numeric values. + * 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. + 2014-09-24 Paul Eggert 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) break; value = make_number (i); if (i == size) - { - Lisp_Object args[2]; - - args[0] = XCHAR_TABLE (table)->extras[4]; - args[1] = Fmake_vector (make_number (1), value); - set_char_table_extras (table, 4, Fvconcat (2, args)); - } + set_char_table_extras (table, 4, Fvconcat (2, ((Lisp_Object []) { + XCHAR_TABLE (table)->extras[4], make_local_vector (1, value) }))); return make_number (i); } 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, { int i, j; char *s; - Lisp_Object args[2], elt; + Lisp_Object elt; /* At first try exact match. */ for (i = 0; i < len; i++) @@ -399,9 +399,9 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, eassert (len < 255); elt = Fmake_vector (make_number (2), make_number (100)); ASET (elt, 1, val); - args[0] = table; - args[1] = Fmake_vector (make_number (1), elt); - ASET (font_style_table, prop - FONT_WEIGHT_INDEX, Fvconcat (2, args)); + ASET (font_style_table, prop - FONT_WEIGHT_INDEX, + Fvconcat (2, ((Lisp_Object []) + { table, make_local_vector (1, elt) }))); return (100 << 8) | (i << 4); } else @@ -2685,7 +2685,9 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) { Lisp_Object entity, val; enum font_property_index prop; - int i; + /* If USE_STACK_LISP_OBJECTS, MAX is used to avoid unbounded alloca. */ + ptrdiff_t i, max + = (USE_STACK_LISP_OBJECTS ? MAX_ALLOCA / sizeof (struct Lisp_Cons) : 0); for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) { @@ -2713,7 +2715,7 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) } if (NILP (spec)) { - val = Fcons (entity, val); + val = --max > 0 ? local_cons (entity, val) : Fcons (entity, val); continue; } 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) AREF (entity, FONT_AVGWIDTH_INDEX))) prop = FONT_SPEC_MAX; if (prop < FONT_SPEC_MAX) - val = Fcons (entity, val); + val = --max > 0 ? local_cons (entity, val) : Fcons (entity, val); } return (Fvconcat (1, &val)); } 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) static Lisp_Object append_key (Lisp_Object key_sequence, Lisp_Object key) { - Lisp_Object args[2]; - - args[0] = key_sequence; - args[1] = list1 (key); - return Fvconcat (2, args); + return Fvconcat (2, ((Lisp_Object []) { key_sequence, scoped_list1 (key) })); } /* Given a event type C which is a symbol,