changeset 71871:dcd566ed4e9b

(Findirect_function): Optimize for no indirection.
author Kim F. Storm <storm@cua.dk>
date Thu, 13 Jul 2006 13:43:44 +0000
parents a0954041b695
children b20203b004f8
files src/data.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/data.c	Thu Jul 13 13:43:38 2006 +0000
+++ b/src/data.c	Thu Jul 13 13:43:44 2006 +0000
@@ -1913,13 +1913,18 @@
 {
   Lisp_Object result;
 
-  result = indirect_function (object);
-
-  if (EQ (result, Qunbound))
-    return (NILP (noerror)
-	    ? Fsignal (Qvoid_function, Fcons (object, Qnil))
-	    : Qnil);
-  return result;
+  /* Optimize for no indirection.  */
+  result = object;
+  if (SYMBOLP (result) && !EQ (result, Qunbound)
+      && (result = XSYMBOL (result)->function, SYMBOLP (result)))
+    result = indirect_function (result);
+  if (!EQ (result, Qunbound))
+    return result;
+
+  if (NILP (noerror))
+    Fsignal (Qvoid_function, Fcons (object, Qnil));
+
+  return Qnil;
 }
 
 /* Extract and set vector and string elements */