From patchwork Thu May 2 11:51:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 32482 Received: (qmail 25209 invoked by alias); 2 May 2019 11:51:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 24459 invoked by uid 89); 2 May 2019 11:51:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=walker, visit X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] iconv: Use __twalk_r in __gconv_release_shlib Date: Thu, 02 May 2019 13:51:43 +0200 Message-ID: <87y33pvzu8.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 2019-05-02 Florian Weimer * iconv/gconv_dl.c (release_handle): Remove file-level definition. (do_release_shlib): Adjust for __twalk_r. (__gconv_release_shlib): Call __twalk_r. 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); }