about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKostya Serebryany <konstantin.s.serebryany@gmail.com>2014-10-01 14:34:45 -0700
committerKostya Serebryany <konstantin.s.serebryany@gmail.com>2014-10-01 14:34:45 -0700
commit06210a44e98960b2c591f3ffad1876e2f64337c3 (patch)
tree3b7782eb9f9b0b3d46d79975e73693cf11c2db85
parent6268f532b6c6be7971cb57883d042bd771966548 (diff)
downloadglibc-06210a44e98960b2c591f3ffad1876e2f64337c3.tar.gz
glibc-06210a44e98960b2c591f3ffad1876e2f64337c3.tar.xz
glibc-06210a44e98960b2c591f3ffad1876e2f64337c3.zip
remove nested functions from elf/dl-deps.c
-rw-r--r--ChangeLog6
-rw-r--r--elf/dl-deps.c30
2 files changed, 21 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d9066eeb0..dedc578b7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-01  Kostya Serebryany  <konstantin.s.serebryany@gmail.com>
+
+	* elf/dl-deps.c
+	(preload): New functions broken out of _dl_map_object_deps.
+	(_dl_map_object_deps):  Remove a nested function. Update call sites.
+
 2014-10-01  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #14138]
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index c3b0cfc908..f66b2669ac 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -138,6 +138,19 @@ cannot load auxiliary `%s' because of empty dynamic string token "	      \
 									      \
     __result; })
 
+static void
+preload (struct list *known, unsigned int *nlist, struct link_map *map)
+{
+  known[*nlist].done = 0;
+  known[*nlist].map = map;
+  known[*nlist].next = &known[*nlist + 1];
+
+  ++*nlist;
+  /* We use `l_reserved' as a mark bit to detect objects we have
+     already put in the search list and avoid adding duplicate
+     elements later in the list.  */
+  map->l_reserved = 1;
+}
 
 void
 internal_function
@@ -155,28 +168,15 @@ _dl_map_object_deps (struct link_map *map,
   const char *errstring;
   const char *objname;
 
-  void preload (struct link_map *map)
-    {
-      known[nlist].done = 0;
-      known[nlist].map = map;
-      known[nlist].next = &known[nlist + 1];
-
-      ++nlist;
-      /* We use `l_reserved' as a mark bit to detect objects we have
-	 already put in the search list and avoid adding duplicate
-	 elements later in the list.  */
-      map->l_reserved = 1;
-    }
-
   /* No loaded object so far.  */
   nlist = 0;
 
   /* First load MAP itself.  */
-  preload (map);
+  preload (known, &nlist, map);
 
   /* Add the preloaded items after MAP but before any of its dependencies.  */
   for (i = 0; i < npreloads; ++i)
-    preload (preloads[i]);
+    preload (known, &nlist, preloads[i]);
 
   /* Terminate the lists.  */
   known[nlist - 1].next = NULL;