From 6c3e09489e0e660a4b6e50e875e246c7fcc554f4 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 26 Jul 2017 15:28:41 +0200 Subject: [PATCH] autfilt, dstar2tgba: remove some superfluous arguments * bin/autfilt.cc, bin/dstar2tgba.cc, bin/common_hoaread.hh: The filename is stored in the parsed automaton, so do not pass it another time to the printer. --- bin/autfilt.cc | 6 +++--- bin/common_hoaread.hh | 23 ++++++++++------------- bin/dstar2tgba.cc | 5 ++--- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/bin/autfilt.cc b/bin/autfilt.cc index 853a52de0..e321b8c62 100644 --- a/bin/autfilt.cc +++ b/bin/autfilt.cc @@ -969,8 +969,7 @@ namespace } int - process_automaton(const spot::const_parsed_aut_ptr& haut, - const char* filename) override + process_automaton(const spot::const_parsed_aut_ptr& haut) override { process_timer timer; timer.start(); @@ -1234,7 +1233,8 @@ namespace ++match_count; - printer.print(aut, timer, nullptr, filename, -1, haut, prefix, suffix); + printer.print(aut, timer, nullptr, haut->filename.c_str(), -1, + haut, prefix, suffix); if (opt_max_count >= 0 && match_count >= opt_max_count) abort_run = true; diff --git a/bin/common_hoaread.hh b/bin/common_hoaread.hh index 2a670cafb..8e8516585 100644 --- a/bin/common_hoaread.hh +++ b/bin/common_hoaread.hh @@ -58,8 +58,7 @@ public: } virtual int - process_automaton(const spot::const_parsed_aut_ptr& haut, - const char* filename) = 0; + process_automaton(const spot::const_parsed_aut_ptr& haut) = 0; int process_string(const std::string& input, const char* filename, int linenum) override @@ -68,14 +67,13 @@ public: loc << filename << ':' << linenum; std::string locstr = loc.str(); return process_automaton_stream - (spot::automaton_stream_parser(input.c_str(), locstr, opt_parse), - locstr.c_str()); + (spot::automaton_stream_parser(input.c_str(), locstr, opt_parse)); } int - aborted(const spot::const_parsed_aut_ptr& h, const char* filename) + aborted(const spot::const_parsed_aut_ptr& h) { - std::cerr << filename << ':' << h->loc << ": aborted input automaton\n"; + std::cerr << h->filename << ':' << h->loc << ": aborted input automaton\n"; return 2; } @@ -119,12 +117,10 @@ public: } return process_automaton_stream(spot::automaton_stream_parser(filename, - opt_parse), - filename); + opt_parse)); } - int process_automaton_stream(spot::automaton_stream_parser&& hp, - const char* filename) + int process_automaton_stream(spot::automaton_stream_parser&& hp) { int err = 0; while (!abort_run) @@ -135,11 +131,12 @@ public: if (haut->format_errors(std::cerr)) err = 2; if (!haut->aut) - error(2, 0, "failed to read automaton from %s", filename); + error(2, 0, "failed to read automaton from %s", + haut->filename.c_str()); else if (haut->aborted) - err = std::max(err, aborted(haut, filename)); + err = std::max(err, aborted(haut)); else - process_automaton(haut, filename); + process_automaton(haut); } return err; } diff --git a/bin/dstar2tgba.cc b/bin/dstar2tgba.cc index 3ecc408d4..db101211a 100644 --- a/bin/dstar2tgba.cc +++ b/bin/dstar2tgba.cc @@ -120,15 +120,14 @@ namespace } int - process_automaton(const spot::const_parsed_aut_ptr& haut, - const char* filename) override + process_automaton(const spot::const_parsed_aut_ptr& haut) override { process_timer timer; timer.start(); auto nba = spot::to_generalized_buchi(haut->aut); auto aut = post.run(nba, nullptr); timer.stop(); - printer.print(aut, timer, nullptr, filename, -1, haut); + printer.print(aut, timer, nullptr, haut->filename.c_str(), -1, haut); flush_cout(); return 0; }