From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by sourceware.org (Postfix) with ESMTPS id 1458E3858404 for ; Tue, 27 Sep 2022 18:10:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1458E3858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=otheo.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=otheo.eu Received: (Authenticated sender: #01#@otheo.eu) by mail.gandi.net (Postfix) with ESMTPSA id DB1D7240007 for ; Tue, 27 Sep 2022 18:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=otheo.eu; s=gm1; t=1664302206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h1d1pyOnD8sDS7m7jGNux9bEAbVWCh0GpoeuwW5U0LE=; b=ltiiu7V/LHBZD7sY20SClcUPCAocBBml4pvefMj08AzTM0S8QmaQBDMGf1RJsfEnat8IGK Kf78sHRJ1BtpABPL/v/rQub3SUhTkgbZCVZ9TKNnmLf4pFuOa6CjXu558So8AK6CIdZFiG i1PKDEJ5E7Ri8oLbXduhfgbshMDIuongSoNv72rjfNoQvGkGgqRhuS4w6bqLzgHReKsp8h jwe4odQunoUezL3VceVHpvEAMk/1nDHIhOrVFKnR30uYCx3A2lFZ2xdE9JNw7KgSCpS1s+ iVfeciECrMBFUyh5bRy2dZrMlR01blgUASxQQxeT3A19/2Bq1WI3/PsCeDvxvg== Date: Tue, 27 Sep 2022 20:10:08 +0200 From: Javier Pello To: libc-alpha@sourceware.org Subject: [PATCH v3 8/8] elf: Simplify output of hwcap subdirectories in ld.so help Message-Id: <20220927201008.ee65c40e3703598164e60dff@otheo.eu> In-Reply-To: <20220927200352.0424a12908a437fef9d3a7bc@otheo.eu> References: <20220905200652.d69204581d15c64647da5cd2@otheo.eu> <87h71l9crb.fsf@oldenburg.str.redhat.com> <20220906201207.e7b3d08272af5649754e76b1@otheo.eu> <87h71i6rfa.fsf@oldenburg.str.redhat.com> <20220914200724.8e685fbbaf441c96d19011c6@otheo.eu> <20220917161748.2b76e1731a27eb78880ee57c@otheo.eu> <20220927200352.0424a12908a437fef9d3a7bc@otheo.eu> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The print_hwcap_1 machinery was useful for the legacy hwcaps subdirectories, but it is not worth the trouble now that they are gone. Signed-off-by: Javier Pello --- elf/dl-usage.c | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/elf/dl-usage.c b/elf/dl-usage.c index efd6c77c..754a6391 100644 --- a/elf/dl-usage.c +++ b/elf/dl-usage.c @@ -104,34 +104,6 @@ print_search_path_for_help (struct dl_main_state *state) print_search_path_for_help_1 (__rtld_search_dirs.dirs); } -/* Helper function for printing flags associated with a HWCAP name. */ -static void -print_hwcap_1 (bool *first, bool active, const char *label) -{ - if (active) - { - if (*first) - { - _dl_printf (" ("); - *first = false; - } - else - _dl_printf (", "); - _dl_printf ("%s", label); - } -} - -/* Called after a series of print_hwcap_1 calls to emit the line - terminator. */ -static void -print_hwcap_1_finish (bool *first) -{ - if (*first) - _dl_printf ("\n"); - else - _dl_printf (")\n"); -} - /* Print the header for print_hwcaps_subdirectories. */ static void print_hwcaps_subdirectories_header (bool *nothing_printed) @@ -165,9 +137,7 @@ print_hwcaps_subdirectories (const struct dl_main_state *state) { print_hwcaps_subdirectories_header (¬hing_printed); print_hwcaps_subdirectories_name (&split); - bool first = true; - print_hwcap_1 (&first, true, "searched"); - print_hwcap_1_finish (&first); + _dl_printf (" (searched)\n"); } /* The built-in glibc-hwcaps subdirectories. Do the filtering @@ -178,13 +148,14 @@ print_hwcaps_subdirectories (const struct dl_main_state *state) { print_hwcaps_subdirectories_header (¬hing_printed); print_hwcaps_subdirectories_name (&split); - bool first = true; - print_hwcap_1 (&first, mask & 1, "supported"); bool listed = _dl_hwcaps_contains (state->glibc_hwcaps_mask, split.segment, split.length); - print_hwcap_1 (&first, !listed, "masked"); - print_hwcap_1 (&first, (mask & 1) && listed, "searched"); - print_hwcap_1_finish (&first); + if (mask & 1) + _dl_printf (" (supported, %s)\n", listed ? "searched" : "masked"); + else if (!listed) + _dl_printf (" (masked)\n"); + else + _dl_printf ("\n"); mask >>= 1; } -- 2.37.3