public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] elf: Simplify output of hwcap subdirectories in ld.so help
Date: Thu,  6 Oct 2022 11:03:08 +0000 (GMT)	[thread overview]
Message-ID: <20221006110308.A2CD4384B838@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e76369ed6371734f77f468eab097ef4e5b5db1c5

commit e76369ed6371734f77f468eab097ef4e5b5db1c5
Author: Javier Pello <devel@otheo.eu>
Date:   Tue Sep 27 20:10:08 2022 +0200

    elf: Simplify output of hwcap subdirectories in ld.so help
    
    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 <devel@otheo.eu>
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Diff:
---
 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 efd6c77c25..754a6391bf 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 (&nothing_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 (&nothing_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;
     }

                 reply	other threads:[~2022-10-06 11:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221006110308.A2CD4384B838@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).