]> git.eshelyaron.com Git - emacs.git/commitdiff
* chartab.c (uniprop_encode_value_numeric):
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 24 Sep 2014 11:11:14 +0000 (15:11 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 24 Sep 2014 11:11:14 +0000 (15:11 +0400)
* 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.

src/ChangeLog
src/chartab.c
src/font.c
src/keymap.c

index ca0e9302578f6f3fb12c9208f616c267c2a03dcf..ec4f051f483736df7905042bd05a7b59b6f1ff29 100644 (file)
        (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  <eggert@cs.ucla.edu>
 
        Fix some slow uses and misuses of strcat.
index 50f76fcf57bcc9a85bb23de1f912aecb410fb40d..0653783d02ae252b355b542bd8b3734db36b308a 100644 (file)
@@ -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);
 }
 
index 1324b6e99c2f08bf0319db3864f66ba41abeb619..496fcd5f1a863a78051b7939f8310999ccf5082b 100644 (file)
@@ -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));
 }
index a1299ec8554aee30b044089fd0b11045714d4629..1d85a403554f6c014fc820ed7782e3422a581545 100644 (file)
@@ -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,