* alloc.c (discard_killed_buffers): Tune and simplify a bit.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 11 Sep 2012 20:35:23 +0000 (13:35 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 11 Sep 2012 20:35:23 +0000 (13:35 -0700)
Use pointer-to-a-pointer to simplify and avoid a NILP check each
time an item is removed.  No need to mark this function 'inline';
the compiler knows better than we do.

src/ChangeLog
src/alloc.c

index 6cb0e65..2b0686c 100644 (file)
@@ -1,3 +1,10 @@
+2012-09-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * alloc.c (discard_killed_buffers): Tune and simplify a bit.
+       Use pointer-to-a-pointer to simplify and avoid a NILP check each
+       time an item is removed.  No need to mark this function 'inline';
+       the compiler knows better than we do.
+
 2012-09-11  Jan Djärv  <jan.h.d@swipnet.se>
 
        * nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize.
index fb16b7d..61cb708 100644 (file)
@@ -5868,25 +5868,21 @@ mark_buffer (struct buffer *buffer)
 /* Remove killed buffers or items whose car is a killed buffer
    from LIST and return changed LIST.  Called during GC.  */
 
-static inline Lisp_Object
+static Lisp_Object
 discard_killed_buffers (Lisp_Object list)
 {
-  Lisp_Object tail, prev, tem;
+  Lisp_Object *prev = &list;
+  Lisp_Object tail;
 
-  for (tail = list, prev = Qnil; CONSP (tail); tail = XCDR (tail))
+  for (tail = list; CONSP (tail); tail = XCDR (tail))
     {
-      tem = XCAR (tail);
+      Lisp_Object tem = XCAR (tail);
       if (CONSP (tem))
        tem = XCAR (tem);
       if (BUFFERP (tem) && !BUFFER_LIVE_P (XBUFFER (tem)))
-       {
-         if (NILP (prev))
-           list = XCDR (tail);
-         else
-           XSETCDR (prev, XCDR (tail));
-       }
+       *prev = XCDR (tail);
       else
-       prev = tail;
+       prev = &XCDR_AS_LVALUE (tail);
     }
   return list;
 }
@@ -6045,7 +6041,7 @@ mark_object (Lisp_Object arg)
            {
              struct window *w = (struct window *) ptr;
              bool leaf = NILP (w->hchild) && NILP (w->vchild);
-             
+
              /* For live windows, Lisp code filters out killed buffers
                 from both buffer lists.  For dead windows, we do it here
                 in attempt to help GC to reclaim killed buffers faster.  */