4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-30 19:10:36 +08:00

* dll_init.cc (dll_global_dtors): Add an additional test to avoid walking the

linked list if it is empty.
(dll_list::detach): Don't set dll_global_dtors_recorded if we aren't actually
going to record any dlls.
This commit is contained in:
Christopher Faylor 2008-08-05 14:26:47 +00:00
parent bee18f45fd
commit 53364a1fae
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2008-08-05 Christopher Faylor <me+cygwin@cgf.cx>
* dll_init.cc (dll_global_dtors): Add an additional test to avoid
walking the linked list if it is empty.
(dll_list::detach): Don't set dll_global_dtors_recorded if we aren't
actually going to record any dlls.
2008-08-04 Christopher Faylor <me+cygwin@cgf.cx> 2008-08-04 Christopher Faylor <me+cygwin@cgf.cx>
Changes suggested by Dave Korn. Changes suggested by Dave Korn.

View File

@ -31,7 +31,7 @@ dll_global_dtors ()
{ {
int recorded = dll_global_dtors_recorded; int recorded = dll_global_dtors_recorded;
dll_global_dtors_recorded = false; dll_global_dtors_recorded = false;
if (recorded) if (recorded && dlls.start.next)
for (dll *d = dlls.end; d != &dlls.start; d = d->prev) for (dll *d = dlls.end; d != &dlls.start; d = d->prev)
d->p.run_dtors (); d->p.run_dtors ();
} }
@ -217,10 +217,9 @@ dll_list::detach (void *retaddr)
void void
dll_list::init () dll_list::init ()
{ {
dll_global_dtors_recorded = true;
/* Walk the dll chain, initializing each dll */ /* Walk the dll chain, initializing each dll */
dll *d = &start; dll *d = &start;
dll_global_dtors_recorded = d->next != NULL;
while ((d = d->next)) while ((d = d->next))
d->init (); d->init ();
} }