changeset 16568:cc6d85f9df0f

(Fmodify_frame_parameters): Use alist in reverse order.
author Richard M. Stallman <rms@gnu.org>
date Tue, 12 Nov 1996 06:03:20 +0000
parents a41b302694aa
children a3c07728832a
files src/frame.c
diffstat 1 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/frame.c	Tue Nov 12 04:49:23 1996 +0000
+++ b/src/frame.c	Tue Nov 12 06:03:20 1996 +0000
@@ -1816,13 +1816,35 @@
     IT_set_frame_parameters (f, alist);
   else
 #endif
-    for (tail = alist; !EQ (tail, Qnil); tail = Fcdr (tail))
-      {
-	elt = Fcar (tail);
-	prop = Fcar (elt);
-	val = Fcdr (elt);
-	store_frame_param (f, prop, val);
-      }
+    {
+      int length = XINT (Flength (alist));
+      int i;
+      Lisp_Object *parms
+	= (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
+      Lisp_Object *values
+	= (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
+
+      /* Extract parm names and values into those vectors.  */
+
+      i = 0;
+      for (tail = alist; CONSP (tail); tail = Fcdr (tail))
+	{
+	  Lisp_Object elt, prop, val;
+
+	  elt = Fcar (tail);
+	  parms[i] = Fcar (elt);
+	  values[i] = Fcdr (elt);
+	  i++;
+	}
+
+      /* Now process them in reverse of specified order.  */
+      for (i--; i >= 0; i--)
+	{
+	  prop = parms[i];
+	  val = values[i];
+	  store_frame_param (f, prop, val);
+	}
+    }
 
   return Qnil;
 }