about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-25 07:06:03 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-25 07:06:03 +0000
commit7e036a01346eea3d1478a56684f69f441121a0a4 (patch)
tree5604349c7c37e8cc3e134bfcb83e16f42bd8b208 /elf/dl-close.c
parente30f2b9828ddff95b687b9818787ab2a99570f11 (diff)
downloadglibc-7e036a01346eea3d1478a56684f69f441121a0a4.tar.gz
glibc-7e036a01346eea3d1478a56684f69f441121a0a4.tar.xz
glibc-7e036a01346eea3d1478a56684f69f441121a0a4.zip
Update.
2000-10-25  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-close.c (_dl_close): Optimize a bit by optimizing out the
	nsearchlist variable.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index c98a21d57d..3a6f294b19 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -51,7 +51,6 @@ _dl_close (void *_map)
   } *reldeps = NULL;
   struct link_map **list;
   struct link_map *map = _map;
-  unsigned int nsearchlist;
   unsigned int i;
   unsigned int *new_opencount;
 
@@ -91,18 +90,17 @@ _dl_close (void *_map)
     }
 
   list = map->l_initfini;
-  nsearchlist = map->l_searchlist.r_nlist;
 
   /* Compute the new l_opencount values.  */
-  new_opencount = (unsigned int *) alloca (nsearchlist
+  new_opencount = (unsigned int *) alloca (map->l_searchlist.r_nlist
 					   * sizeof (unsigned int));
-  for (i = 0; i < nsearchlist; ++i)
+  for (i = 0; list[i] != NULL; ++i)
     {
       list[i]->l_idx = i;
       new_opencount[i] = list[i]->l_opencount;
     }
   --new_opencount[0];
-  for (i = 1; i < nsearchlist; ++i)
+  for (i = 1; list[i] != NULL; ++i)
     if (! (list[i]->l_flags_1 & DF_1_NODELETE)
 	/* Decrement counter.  */
 	&& --new_opencount[i] == 0
@@ -117,14 +115,14 @@ _dl_close (void *_map)
 	for (j = 1; j < list[i]->l_searchlist.r_nlist; ++j)
 	  if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE))
 	    {
-	      assert (dep_list[j]->l_idx < nsearchlist);
+	      assert (dep_list[j]->l_idx < map->l_searchlist.r_nlist);
 	      --new_opencount[dep_list[j]->l_idx];
 	    }
       }
   assert (new_opencount[0] == 0);
 
   /* Call all termination functions at once.  */
-  for (i = 0; i < nsearchlist; ++i)
+  for (i = 0; list[i] != NULL; ++i)
     {
       struct link_map *imap = list[i];
       if (new_opencount[i] == 0 && imap->l_type == lt_loaded
@@ -170,7 +168,7 @@ _dl_close (void *_map)
 
   /* Check each element of the search list to see if all references to
      it are gone.  */
-  for (i = 0; i < nsearchlist; ++i)
+  for (i = 0; list[i] != NULL; ++i)
     {
       struct link_map *imap = list[i];
       if (imap->l_opencount == 0 && imap->l_type == lt_loaded)