about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-05-02 12:37:21 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-05-02 12:37:21 +0200
commita7b23b351e1ca19a29b0b82f32ffb63c0ac4fef9 (patch)
treef15a497c31c7c59b9f72c4c9f8e5726eb86fa05e
parent7b807a35a8dc63f9742cecf0fc3db46c30e28b0d (diff)
downloadglibc-fw/twalk_r-iconv.tar.gz
glibc-fw/twalk_r-iconv.tar.xz
glibc-fw/twalk_r-iconv.zip
iconv: Use __twalk_r in __gconv_release_shlib fw/twalk_r-iconv
-rw-r--r--ChangeLog6
-rw-r--r--iconv/gconv_dl.c15
2 files changed, 10 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 4473569abc..d92a37143f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2019-05-02  Florian Weimer  <fweimer@redhat.com>
 
+	* iconv/gconv_dl.c (release_handle): Remove file-level definition.
+	(do_release_shlib): Adjust for __twalk_r.
+	(__gconv_release_shlib): Call __twalk_r.
+
+2019-05-02  Florian Weimer  <fweimer@redhat.com>
+
 	misc: Add twalk_r function.
 	* include/search.h (__twalk_r): Declare.
 	* manual/examples/twalk.c: New file.
diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c
index cf7023a9aa..8379a488ed 100644
--- a/iconv/gconv_dl.c
+++ b/iconv/gconv_dl.c
@@ -149,15 +149,11 @@ __gconv_find_shlib (const char *name)
   return found;
 }
 
-
-/* This is very ugly but the tsearch functions provide no way to pass
-   information to the walker function.  So we use a global variable.
-   It is MT safe since we use a lock.  */
-static struct __gconv_loaded_object *release_handle;
-
 static void
-do_release_shlib (void *nodep, VISIT value, int level)
+do_release_shlib (const void *nodep, VISIT value, void *closure)
 {
+
+  struct __gconv_loaded_object *release_handle = closure;
   struct __gconv_loaded_object *obj = *(struct __gconv_loaded_object **) nodep;
 
   if (value != preorder && value != leaf)
@@ -184,13 +180,10 @@ do_release_shlib (void *nodep, VISIT value, int level)
 void
 __gconv_release_shlib (struct __gconv_loaded_object *handle)
 {
-  /* Urgh, this is ugly but we have no other possibility.  */
-  release_handle = handle;
-
   /* Process all entries.  Please note that we also visit entries
      with release counts <= 0.  This way we can finally unload them
      if necessary.  */
-  __twalk (loaded, (__action_fn_t) do_release_shlib);
+  __twalk_r (loaded, do_release_shlib, handle);
 }