From 32ce30a23cb3a1ae583877b6f7e7a6958f3aab02 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 6 Aug 2013 15:42:33 -0700 Subject: [PATCH] First pass clean reading API. * include/abg-reader.h (read_file): Remove extraneous file parameter. * src/abg-reader.cc: Same. * tests/test-read-write.cc: Adjust. --- include/abg-reader.h | 2 +- src/abg-reader.cc | 5 ++--- tests/test-read-write.cc | 2 +- tests/test-walker.cc | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/abg-reader.h b/include/abg-reader.h index 230e5645..c17e8b9b 100644 --- a/include/abg-reader.h +++ b/include/abg-reader.h @@ -31,7 +31,7 @@ namespace abigail namespace reader { bool - read_file(const std::string& file_path, translation_unit& tu); + read_file(translation_unit& tu); }// end namespace reader }// end namespace abigail diff --git a/src/abg-reader.cc b/src/abg-reader.cc index f4c4146a..037d1e30 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -486,10 +486,9 @@ static bool handle_function_template_decl(read_context&); static bool handle_class_template_decl(read_context&); bool -read_file(const string& file_path, - translation_unit& tu) +read_file(translation_unit& tu) { - read_context read_ctxt(xml::new_reader_from_file(file_path)); + read_context read_ctxt(xml::new_reader_from_file(tu.get_path())); return read_input(read_ctxt, tu); } diff --git a/tests/test-read-write.cc b/tests/test-read-write.cc index 3ac5eab2..96f8e2f5 100644 --- a/tests/test-read-write.cc +++ b/tests/test-read-write.cc @@ -144,7 +144,7 @@ main() string input_suffix(s->in_path); in_path = abigail::tests::get_src_dir() + "/tests/" + input_suffix; abigail::translation_unit tu(input_suffix); - if (!abigail::reader::read_file(in_path, tu)) + if (!abigail::reader::read_file(tu)) { cerr << "failed to read " << in_path << "\n"; is_ok = false; diff --git a/tests/test-walker.cc b/tests/test-walker.cc index 0cf5eb52..7345d605 100644 --- a/tests/test-walker.cc +++ b/tests/test-walker.cc @@ -50,7 +50,7 @@ main(int argc, char **argv) string file_name = argv[1]; abigail::translation_unit tu(file_name); - if (!abigail::reader::read_file(file_name, tu)) + if (!abigail::reader::read_file(tu)) { cerr << "failed to read " << file_name << "\n"; return 1;