libabigail/tools
Dodji Seketeli e0b4f2b7e2 Important organizational changes in abipkgdiff.cc
This patch introduces many changes that should hopefully improve
legibility and ease of maintenance.  Here is a list of the topic of
the changes:

  * Avoid using shortened names when the line is not too long.

  * Use shared_ptr when possible.

  * When a function parameter is not meant to be nil, do not pass it
    as a pointer; rather, pass it as a reference.

  * Avoid doing things that can "fail" in a destructor; e.g, spawning
    a process.  Also, it's not common practise to cleanup a resource in a
    type destructor, when that resource has not been created in one of the
    member functions of the type.  It eases maintenance when resource
    creation and cleanup is performed at the same logical level.

	* tools/abipkgdiff.cc (option::package{1,2}): Rename
	option::pkg{1,2} into this, to increase legibility.
	(option::debug_package{1,2}): Likewise, rename
	option::debug_pkg{1,2} into this.
	(elf_file::~elf_file): Do not "delete this" in a destructor.  This
	leads to double free.  It's when someone invokes the "delete"
	operator on a pointer to the object that the destructor of the
	object is executed automatically; so if in the destructor the
	delete operator is called again, bad things are going to happen.
	As the destructor is now empty, remove it altogether.
	(elf_file_sptr): New typedef for shared_ptr<elf_file>.
	(package::path): Rename package::pkg_path into this, for better
	legibility.
	(package::extracted_package_dir_path): Rename
	package::extracted_pkg_dir_path into this.
	(package::type): Rename package::pkg_type into this.
	(package::is_debug_info): Rename package::is_debuginfo_pkg into
	this.
	(package::path_elf_file_sptr_map): Rename
	package::dir_elf_files_map into this because this is a map of
	path -> elf_file_sptr.  Also, now the value of the map element is
	a elf_file_sptr, no more an elf_file*.
	(package::debug_info_package): Rename package::debuginfo_pkg into
	this.
	(package::package): Adjust for the changes above.
	(package::{erase_extraction_directory,
	erase_extraction_directories}): New member functions.
	(elf_file_paths): Renamed dir_elf_files_path into this.
	(erase_created_temporary_directories)
	(create_maps_of_package_content)
	(extract_package_and_map_its_content, prepare_packages): New
	static functions.
	(get_soname, elf_file_type, extract_rpm): Make this static.
	(extract_package): Take a const package& rather than a
	package_sptr to express that the function really expects a non-nil
	object by reference (not by copy) and that the object won't be
	modified.  Using a reference removes the possibility that the
	pointer could be nil, causing crashes in the code where
	parameter->something was used.  Now only parameter.something can
	be used, so no crash possible there.  This is more solid code.
	(file_tree_walker_callback_fn): Rename callback() into this.  It
	makes the code more legible and kind of 'self-documented'.  At
	least you get the hint that this is a callback function for some
	file tree walking (ftw) function. Adjust for the relevant names
	renaming above.
	(compare): Rename compute_abidiff into this; again, this increases
	legibility; at least at the point of use of this function.  Rename
	compare_package() into a an overload of compare() as well.
	compare_package() used to take a vector of packages.  It was hard
	to guess by reading the signature of the function, which element
	of the vector is expected to be the first vector of the
	comparison, which one is to be the second, etc.  Now, this
	function takes two packages, named first_package and
	second_package.  That is more "typed"; that is, the signature is
	more meaningful.  Greater legibility, hopefully.  And in the body
	of the function, the debug information packages are now accessed
	using the package::debug_info_package data member.  Again, this is
	less surprising, I believe.  Also, explicitly erase the temporary
	files that were created during this comparison.  All this
	simplifies the logic of this function, hopefully.
	(parse_command_line): Make this static.  Add new --d1 and --d2
	command line switches that are shortcuts of --debug-info-pkg1 and
	--debug-info-pkg2.  Adjust this function for the relevant name
	changes above.  Make lines be shorter than 80 characters.
	(main): Do not create any vector of parameters anymore as the
	compare_packages() function don't take any vector of parameter
	anymore.  Just instantiate first_package and second_package now.
	Adjust for the relevant name changes above.  This hopefully
	simplifies the logic of this function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:08:56 +02:00
..
.gitignore Add .gitignore files. 2014-09-12 11:05:01 +02:00
abiar.cc Adjust archive-related code for the recent addition of tools_utils::* 2015-01-13 11:02:10 +01:00
abicompat.cc Handle the life time of the map of canonical types 2015-07-09 11:12:40 +02:00
abidiff.cc Guess RPM file type 2015-07-17 10:07:37 +02:00
abidw.cc Handle the life time of the map of canonical types 2015-07-09 11:12:40 +02:00
abilint.cc Guess RPM file type 2015-07-17 10:07:37 +02:00
abipkgdiff.cc Important organizational changes in abipkgdiff.cc 2015-07-17 10:08:56 +02:00
abisym.cc Fix symbols comparison 2015-06-02 00:07:02 +02:00
binilint.cc Update copyright years 2015-01-07 17:52:10 +01:00
Makefile.am Initial skeleton of abipkgdiff tool 2015-07-17 10:07:37 +02:00