public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Tiny code reorgination
@ 2023-05-25 19:44 Ben Woodard
  0 siblings, 0 replies; only message in thread
From: Ben Woodard @ 2023-05-25 19:44 UTC (permalink / raw)
  To: libabigail; +Cc: Ben Woodard

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-25 19:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 19:44 [PATCH] Tiny code reorgination Ben Woodard

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).