From: Paul Eggert Date: Tue, 11 Sep 2012 20:35:23 +0000 (-0700) Subject: * alloc.c (discard_killed_buffers): Tune and simplify a bit. X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/5779a1dc62593be8294edaecfecca4359be9ab4e * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 6cb0e65281..2b0686cc49 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-09-11 Paul Eggert + + * 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 * nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize. diff --git a/src/alloc.c b/src/alloc.c index fb16b7d751..61cb7086c2 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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. */