diff src/buffer.c @ 82:6a378aca36af r20-0b91

Import from CVS: tag r20-0b91
author cvs
date Mon, 13 Aug 2007 09:07:36 +0200
parents c7528f8e288d
children 0d2f883870bc
line wrap: on
line diff
--- a/src/buffer.c	Mon Aug 13 09:06:45 2007 +0200
+++ b/src/buffer.c	Mon Aug 13 09:07:36 2007 +0200
@@ -1548,7 +1548,9 @@
 	{
 	  /* Just reference the variable
 	     to cause it to become set for this buffer.  */
-	  (void) find_symbol_value (sym);
+	  /* Use find_symbol_value_quickly to avoid an unnecessary O(n)
+	     lookup. */
+	  (void) find_symbol_value_quickly (XCAR (tail), 1);
 	}
     }
 
@@ -1556,9 +1558,7 @@
 
   if (old_buf)
     {
-      for (tail = old_buf->local_var_alist; 
-           !NILP (tail);
-           tail = XCDR (tail))
+      LIST_LOOP (tail, old_buf->local_var_alist)
 	{
 	  Lisp_Object sym = XCAR (XCAR (tail));
 	  Lisp_Object valcontents = XSYMBOL (sym)->value;
@@ -1567,7 +1567,11 @@
 	    {
 	      /* Just reference the variable
 		 to cause it to become set for this buffer.  */
-	      (void) find_symbol_value (sym);
+	      /* Use find_symbol_value_quickly with find_it_p as 0 to avoid an
+		 unnecessary O(n) lookup which is guaranteed to be worst case.
+		 Any symbols which are local are guaranteed to have been
+		 handled in the previous loop, above. */
+	      (void) find_symbol_value_quickly (sym, 0);
 	    }
 	}
     }