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 <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-07-08 17:43:20 +02:00
parent 63ffa0320a
commit 2c3677bcfa

View File

@ -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<string, elf_file_sptr> path_elf_file_sptr_map;
shared_ptr<package> 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<char*>((*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;