emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109986: * alloc.c (discard_killed_bu


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109986: * alloc.c (discard_killed_buffers): Tune and simplify a bit.
Date: Tue, 11 Sep 2012 13:35:23 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109986
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2012-09-11 13:35:23 -0700
message:
  * 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.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-11 17:08:02 +0000
+++ b/src/ChangeLog     2012-09-11 20:35:23 +0000
@@ -1,3 +1,10 @@
+2012-09-11  Paul Eggert  <address@hidden>
+
+       * 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  <address@hidden>
 
        * nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-09-11 15:42:50 +0000
+++ b/src/alloc.c       2012-09-11 20:35:23 +0000
@@ -5868,25 +5868,21 @@
 /* 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 @@
            {
              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.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]