From 2c3677bcfa9cb9b578d54bb57d5bf0ecbacc3f5c Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 8 Jul 2015 17:43:20 +0200 Subject: [PATCH] Fix several string passing issues in abipkgdiff.cc A number of functions have string parameters passed by value. Ooops. They must be passed by reference. Fixed thus. * tools/abipkgdiff.cc (elf_file::elf_file): Pass the strings by reference. Also, change the order of the parameters; all the strings are passed first, then the elf_type is passed last. (package::package): Likewise, pass the strings by reference, not by value. (create_maps_of_package_content): Adjust for the change in parameters order of elf_file::elf_file. Signed-off-by: Dodji Seketeli --- tools/abipkgdiff.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc index 34e4f278..9aa68c1b 100644 --- a/tools/abipkgdiff.cc +++ b/tools/abipkgdiff.cc @@ -86,7 +86,10 @@ struct elf_file string soname; elf_type type; - elf_file(string path, string name, elf_type type, string soname) + elf_file(const string& path, + const string& name, + const string& soname, + elf_type type) : name(name), path(path), soname(soname), @@ -112,7 +115,7 @@ struct package map path_elf_file_sptr_map; shared_ptr debug_info_package; - package(string path, string dir, + package(const string& path, const string& dir, abigail::tools_utils::file_type file_type, bool is_debug_info = false) : path(path), @@ -278,10 +281,10 @@ create_maps_of_package_content(package& package) string file_base_name(basename(const_cast((*file).c_str()))); if (soname.empty()) package.path_elf_file_sptr_map[file_base_name] = - elf_file_sptr(new elf_file((*file), file_base_name, e, soname)); + elf_file_sptr(new elf_file((*file), file_base_name, soname, e)); else package.path_elf_file_sptr_map[soname] = - elf_file_sptr( new elf_file((*file), file_base_name, e, soname)); + elf_file_sptr( new elf_file((*file), file_base_name, soname, e)); } return true;