aboutsummaryrefslogtreecommitdiff
path: root/iconv/gconv_dl.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-06-04 14:05:44 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-06-04 14:13:44 +0200
commite863dbf6b26bfddf7c1e5faa1cbf41a5a3ee1382 (patch)
tree7ee644a4e728b7f17b8762762bbff6c53f03c8d8 /iconv/gconv_dl.c
parent4802be92c891903caaf8cae47f685da6f26d4b9a (diff)
downloadglibc-e863dbf6b26bfddf7c1e5faa1cbf41a5a3ee1382.zip
glibc-e863dbf6b26bfddf7c1e5faa1cbf41a5a3ee1382.tar.gz
glibc-e863dbf6b26bfddf7c1e5faa1cbf41a5a3ee1382.tar.bz2
iconv: Use __twalk_r in __gconv_release_shlib
Diffstat (limited to 'iconv/gconv_dl.c')
-rw-r--r--iconv/gconv_dl.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c
index cf7023a..c0342d8 100644
--- a/iconv/gconv_dl.c
+++ b/iconv/gconv_dl.c
@@ -149,15 +149,10 @@ __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 +179,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);
}