changeset 30216:394c884dc496

(eval_form): GCPRO argument sexpr. (call_function): New function. (handle_single_display_prop): Use call_function and FUNCTIONP instead of checking whether if font_height is a symbol and using eval_form.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 14 Jul 2000 13:56:56 +0000
parents 4e401f4a55aa
children 887b4d52a334
files src/xdisp.c
diffstat 1 files changed, 33 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Fri Jul 14 13:56:26 2000 +0000
+++ b/src/xdisp.c	Fri Jul 14 13:56:56 2000 +0000
@@ -1049,7 +1049,7 @@
 			Lisp form evaluation
  ***********************************************************************/
 
-/* Error handler for eval_form.  */
+/* Error handler for eval_form and call_function.  */
 
 static Lisp_Object
 eval_handler (arg)
@@ -1067,9 +1067,35 @@
      Lisp_Object sexpr;
 {
   int count = specpdl_ptr - specpdl;
+  struct gcpro gcpro1;
   Lisp_Object val;
+
+  GCPRO1 (sexpr);
   specbind (Qinhibit_redisplay, Qt);
   val = internal_condition_case_1 (Feval, sexpr, Qerror, eval_handler);
+  UNGCPRO;
+  return unbind_to (count, val);
+}
+
+
+/* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1].
+   Return the result, or nil if something went wrong.  */
+
+Lisp_Object
+call_function (nargs, args)
+     int nargs;
+     Lisp_Object *args;
+{
+  int count = specpdl_ptr - specpdl;
+  Lisp_Object val;
+  struct gcpro gcpro1;
+
+  GCPRO1 (args[0]);
+  gcpro1.nvars = nargs;
+  specbind (Qinhibit_redisplay, Qt);
+  val = internal_condition_case_2 (Ffuncall, nargs, args, Qerror,
+				   eval_handler);
+  UNGCPRO;
   return unbind_to (count, val);
 }
 
@@ -2373,20 +2399,18 @@
 		steps = - steps;
 	      it->face_id = smaller_face (it->f, it->face_id, steps);
 	    }
-	  else if (SYMBOLP (it->font_height))
+	  else if (FUNCTIONP (it->font_height))
 	    {
 	      /* Call function with current height as argument.
 		 Value is the new height.  */
-	      Lisp_Object form, height;
-	      struct gcpro gcpro1;
+	      Lisp_Object args[2], height;
 	      
-	      height = face->lface[LFACE_HEIGHT_INDEX];
-	      form = Fcons (it->font_height, Fcons (height, Qnil));
-	      GCPRO1 (form);
-	      height = eval_form (form);
+	      args[0] = it->font_height;
+	      args[1] = face->lface[LFACE_HEIGHT_INDEX];
+	      height = call_function (2, args);
+	      
 	      if (NUMBERP (height))
 		new_height = XFLOATINT (height);
-	      UNGCPRO;
 	    }
 	  else if (NUMBERP (it->font_height))
 	    {