Tiny code reorgination

Message ID 20230525194428.888014-1-woodard@redhat.com
State New
Headers
Series Tiny code reorgination |

Commit Message

Ben Woodard May 25, 2023, 7:44 p.m. UTC
  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(-)
  

Patch

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;