From: Paul Eggert Date: Tue, 3 Mar 2015 17:10:01 +0000 (-0800) Subject: * alloc.c (run_finalizers): Omit unused local. X-Git-Tag: emacs-25.0.90~2564^2~252 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a6fb5e2de55b936761274f5d0895de178640ec68;p=emacs.git * alloc.c (run_finalizers): Omit unused local. Also, redo newly-added code as per usual Emacs style. --- diff --git a/src/ChangeLog b/src/ChangeLog index f1bdd150905..185769fd33f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2015-03-03 Paul Eggert + + * alloc.c (run_finalizers): Omit unused local. + Also, redo newly-added code as per usual Emacs style. + 2015-03-03 Martin Rudalics * frame.c (adjust_frame_size): If the pixel sizes remain diff --git a/src/alloc.c b/src/alloc.c index eec53e7d844..ff93bf57c26 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3714,7 +3714,7 @@ init_finalizer_list (struct Lisp_Finalizer *head) static void finalizer_insert (struct Lisp_Finalizer *element, - struct Lisp_Finalizer* finalizer) + struct Lisp_Finalizer *finalizer) { eassert (finalizer->prev == NULL); eassert (finalizer->next == NULL); @@ -3727,12 +3727,13 @@ finalizer_insert (struct Lisp_Finalizer *element, static void unchain_finalizer (struct Lisp_Finalizer *finalizer) { - if (finalizer->prev != NULL) { - eassert (finalizer->next != NULL); - finalizer->prev->next = finalizer->next; - finalizer->next->prev = finalizer->prev; - finalizer->prev = finalizer->next = NULL; - } + if (finalizer->prev != NULL) + { + eassert (finalizer->next != NULL); + finalizer->prev->next = finalizer->next; + finalizer->next->prev = finalizer->prev; + finalizer->prev = finalizer->next = NULL; + } } static void @@ -3742,21 +3743,20 @@ mark_finalizer_list (struct Lisp_Finalizer *head) finalizer != head; finalizer = finalizer->next) { - finalizer->base.gcmarkbit = 1; + finalizer->base.gcmarkbit = true; mark_object (finalizer->function); } } -/* Move doomed finalizers in list SRC onto list DEST. A doomed +/* Move doomed finalizers to list DEST from list SRC. A doomed finalizer is one that is not GC-reachable and whose - finalizer->function is non-nil. (We reset finalizer->function to - before attempting to run it.) */ + finalizer->function is non-nil. */ static void queue_doomed_finalizers (struct Lisp_Finalizer *dest, struct Lisp_Finalizer *src) { - struct Lisp_Finalizer* finalizer = src->next; + struct Lisp_Finalizer *finalizer = src->next; while (finalizer != src) { struct Lisp_Finalizer *next = finalizer->next; @@ -3791,23 +3791,23 @@ run_finalizer_function (Lisp_Object function) } static void -run_finalizers (struct Lisp_Finalizer* finalizers) +run_finalizers (struct Lisp_Finalizer *finalizers) { - struct Lisp_Finalizer* finalizer; + struct Lisp_Finalizer *finalizer; Lisp_Object function; - struct gcpro gcpro1; - while (finalizers->next != finalizers) { - finalizer = finalizers->next; - eassert (finalizer->base.type == Lisp_Misc_Finalizer); - unchain_finalizer (finalizer); - function = finalizer->function; - if (!NILP (function)) - { - finalizer->function = Qnil; - run_finalizer_function (function); - } - } + while (finalizers->next != finalizers) + { + finalizer = finalizers->next; + eassert (finalizer->base.type == Lisp_Misc_Finalizer); + unchain_finalizer (finalizer); + function = finalizer->function; + if (!NILP (function)) + { + finalizer->function = Qnil; + run_finalizer_function (function); + } + } } DEFUN ("make-finalizer", Fmake_finalizer, Smake_finalizer, 1, 1, 0, @@ -3819,11 +3819,8 @@ count as reachable for the purpose of deciding whether to run FUNCTION. FUNCTION will be run once per finalizer object. */) (Lisp_Object function) { - Lisp_Object val; - struct Lisp_Finalizer *finalizer; - - val = allocate_misc (Lisp_Misc_Finalizer); - finalizer = XFINALIZER (val); + Lisp_Object val = allocate_misc (Lisp_Misc_Finalizer); + struct Lisp_Finalizer *finalizer = XFINALIZER (val); finalizer->function = function; finalizer->prev = finalizer->next = NULL; finalizer_insert (&finalizers, finalizer); @@ -6514,7 +6511,7 @@ mark_object (Lisp_Object arg) break; case Lisp_Misc_Finalizer: - XMISCANY (obj)->gcmarkbit = 1; + XMISCANY (obj)->gcmarkbit = true; mark_object (XFINALIZER (obj)->function); break; diff --git a/src/lisp.h b/src/lisp.h index 37f3b28242b..b730619726b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2186,18 +2186,18 @@ XSAVE_OBJECT (Lisp_Object obj, int n) return XSAVE_VALUE (obj)->data[n].object; } -/* A finalizer sentinel. We run FUNCTION when this value becomes - unreachable. We treat these values specially in the GC to ensure - that we still run the finalizer even if FUNCTION contains a - reference to the finalizer; i.e., we run a finalizer's function - when FUNCTION is reachable _only_ through finalizers. */ +/* A finalizer sentinel. */ struct Lisp_Finalizer { struct Lisp_Misc_Any base; - /* Circular list of all active weak references */ + + /* Circular list of all active weak references. */ struct Lisp_Finalizer *prev; struct Lisp_Finalizer *next; - /* Called when this object becomes unreachable */ + + /* Call FUNCTION when the finalizer becomes unreachable, even if + FUNCTION contains a reference to the finalizer; i.e., call + FUNCTION when it is reachable _only_ through finalizers. */ Lisp_Object function; };