From e16dc041ec7dbcc83c64533ee4cf8759f6ae0be5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 28 Sep 2009 18:49:51 -0700 Subject: Simplify copy_file calls Every single copy_file call we had was converting strings to char*, printing the same error message, and optionally printing the same verbose string. Let's canonicalize that. * util.cxx (copy_file): Take string filenames, add a verbose flag, and consolidate the message printing. * cache.cxx (add_to_cache): Pass strings and remove message printing. (get_from_cache): Ditto. * main.cxx (main): Ditto. * tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto. (dwarf_cast_expanding_visitor::filter_special_modules): Ditto. --- main.cxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index 8e3c9399..6987d94a 100644 --- a/main.cxx +++ b/main.cxx @@ -1212,19 +1212,13 @@ main (int argc, char * const argv []) // inaccessible for some reason. if (! s.use_cache && s.last_pass == 4) save_module = true; - + // Copy module to the current directory. if (save_module && !pending_interrupts) { string module_src_path = s.tmpdir + "/" + s.module_name + ".ko"; string module_dest_path = s.module_name + ".ko"; - - if (s.verbose > 1) - clog << "Copying " << module_src_path << " to " - << module_dest_path << endl; - if (copy_file(module_src_path.c_str(), module_dest_path.c_str()) != 0) - cerr << "Copy failed (\"" << module_src_path << "\" to \"" - << module_dest_path << "\"): " << strerror(errno) << endl; + copy_file(module_src_path, module_dest_path, s.verbose > 1); } } -- cgit