diff options
author | Josh Stone <jistone@redhat.com> | 2009-09-28 18:49:51 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-09-28 18:49:51 -0700 |
commit | e16dc041ec7dbcc83c64533ee4cf8759f6ae0be5 (patch) | |
tree | 2e5a018c8057e930bcdf27afcc290effb0b25593 /tapsets.cxx | |
parent | 55e50c24c9176f1b3d15af94e145456a68e7ecf6 (diff) | |
download | systemtap-steved-e16dc041ec7dbcc83c64533ee4cf8759f6ae0be5.tar.gz systemtap-steved-e16dc041ec7dbcc83c64533ee4cf8759f6ae0be5.tar.xz systemtap-steved-e16dc041ec7dbcc83c64533ee4cf8759f6ae0be5.zip |
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.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index dfa5f302..abd46aee 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2566,17 +2566,9 @@ void dwarf_cast_expanding_visitor::filter_special_modules(string& module) // no cached module, time to make it if (make_typequery(s, module) == 0) { + // try to save typequery in the cache if (s.use_cache) - { - // try to save typequery in the cache - if (s.verbose > 2) - clog << "Copying " << module - << " to " << cached_module << endl; - if (copy_file(module.c_str(), - cached_module.c_str()) != 0) - cerr << "Copy failed (\"" << module << "\" to \"" - << cached_module << "\"): " << strerror(errno) << endl; - } + copy_file(module, cached_module, s.verbose > 2); } } } @@ -6121,17 +6113,10 @@ tracepoint_builder::get_tracequery_module(systemtap_session& s, if (rc != 0) tracequery_ko = "/dev/null"; + // try to save tracequery in the cache if (s.use_cache) - { - // try to save tracequery in the cache - if (s.verbose > 2) - clog << "Copying " << tracequery_ko - << " to " << tracequery_path << endl; - if (copy_file(tracequery_ko.c_str(), - tracequery_path.c_str()) != 0) - cerr << "Copy failed (\"" << tracequery_ko << "\" to \"" - << tracequery_path << "\"): " << strerror(errno) << endl; - } + copy_file(tracequery_ko, tracequery_path, s.verbose > 2); + return tracequery_ko; } |