public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Ben Woodard <woodard@redhat.com>
To: libabigail@sourceware.org
Cc: Ben Woodard <woodard@redhat.com>
Subject: [PATCH] Tiny code reorgination
Date: Thu, 25 May 2023 12:44:28 -0700	[thread overview]
Message-ID: <20230525194428.888014-1-woodard@redhat.com> (raw)

Make prepare_di_root_paths a member function of the options class.

        * tools/abidiff.cc make prepare_di_root_paths a member function
	* tools/abidw.cc make prepare_di_root_paths a member function

Signed-off-by: Ben Woodard <woodard@redhat.com>
---
 tools/abidiff.cc | 28 ++++++++++++----------------
 tools/abidw.cc   | 21 ++++++++-------------
 2 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index 0e6538eb..dfc6f528 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -208,6 +208,17 @@ struct options
     prepared_di_root_paths1.clear();
     prepared_di_root_paths2.clear();
   }
+
+  /// Convert di_root_paths{1,2} into prepared_di_root_paths{1,2}
+  /// which is the suitable type format that the dwarf_reader expects.
+  void prepare_di_root_paths()
+  {
+    abigail::tools_utils::convert_char_stars_to_char_star_stars
+      (this->di_root_paths1, this->prepared_di_root_paths1);
+
+    abigail::tools_utils::convert_char_stars_to_char_star_stars
+      (this->di_root_paths2, this->prepared_di_root_paths2);
+  }
 };//end struct options;
 
 static void
@@ -997,21 +1008,6 @@ adjust_diff_context_for_kmidiff(diff_context &ctxt)
   ctxt.show_linkage_names(false);
 }
 
-/// Convert options::di_root_paths{1,2} into
-/// options::prepared_di_root_paths{1,2} which is the suitable type
-/// format that the dwarf_reader expects.
-///
-/// @param o the options to consider.
-static void
-prepare_di_root_paths(options& o)
-{
-  abigail::tools_utils::convert_char_stars_to_char_star_stars
-    (o.di_root_paths1, o.prepared_di_root_paths1);
-
-  abigail::tools_utils::convert_char_stars_to_char_star_stars
-    (o.di_root_paths2, o.prepared_di_root_paths2);
-}
-
 /// Emit an appropriate error message if necessary, given an error
 /// code.
 ///
@@ -1194,7 +1190,7 @@ main(int argc, char* argv[])
       return 0;
     }
 
-  prepare_di_root_paths(opts);
+  opts.prepare_di_root_paths();
 
   if (!maybe_check_suppression_files(opts))
     return (abigail::tools_utils::ABIDIFF_USAGE_ERROR
diff --git a/tools/abidw.cc b/tools/abidw.cc
index eead7889..a17ec8b1 100644
--- a/tools/abidw.cc
+++ b/tools/abidw.cc
@@ -181,6 +181,13 @@ struct options
 
     prepared_di_root_paths.clear();
   }
+  /// Convert di_root_paths into prepared_di_root_paths
+  /// which is the suitable type format that the dwarf_reader expects.
+  void prepare_di_root_paths()
+  {
+    tools_utils::convert_char_stars_to_char_star_stars(this->di_root_paths,
+						       this->prepared_di_root_paths);
+  }
 };
 
 static void
@@ -955,18 +962,6 @@ load_kernel_corpus_group_and_write_abixml(char* argv[],
   return exit_code;
 }
 
-/// Convert options::di_root_paths into
-/// options::prepared_di_root_paths which is the suitable type format
-/// that the dwarf_reader expects.
-///
-/// @param o the options to consider.
-static void
-prepare_di_root_paths(options& o)
-{
-  tools_utils::convert_char_stars_to_char_star_stars(o.di_root_paths,
-						     o.prepared_di_root_paths);
-}
-
 int
 main(int argc, char* argv[])
 {
@@ -1012,7 +1007,7 @@ main(int argc, char* argv[])
 	return 1;
     }
 
-  prepare_di_root_paths(opts);
+  opts.prepare_di_root_paths();
 
   if (!maybe_check_suppression_files(opts))
     return 1;
-- 
2.40.1


                 reply	other threads:[~2023-05-25 19:44 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=20230525194428.888014-1-woodard@redhat.com \
    --to=woodard@redhat.com \
    --cc=libabigail@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).