diff options
author | Tilman Sauerbeck <tilman@crux.nu> | 2007-04-17 20:49:58 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@crux.nu> | 2007-04-17 20:49:58 +0200 |
commit | c9984aa86ec99c6dd8d47c2bf3d7a409a1c4fa48 (patch) | |
tree | 719ef230483a50ad0ea481bfaac50e376661e077 /pkgutil.cc | |
parent | bfb5480be95ac565f1a057750429857385478be9 (diff) | |
download | pkgutils-c9984aa86ec99c6dd8d47c2bf3d7a409a1c4fa48.tar.gz pkgutils-c9984aa86ec99c6dd8d47c2bf3d7a409a1c4fa48.tar.xz |
Moved archive initialization code to INIT_ARCHIVE.
Diffstat (limited to 'pkgutil.cc')
-rw-r--r-- | pkgutil.cc | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -42,6 +42,10 @@ #include <archive.h> #include <archive_entry.h> +#define INIT_ARCHIVE(ar) \ + archive_read_support_compression_all((ar)); \ + archive_read_support_format_all((ar)) + using __gnu_cxx::stdio_filebuf; pkgutil::pkgutil(const string& name) @@ -342,8 +346,7 @@ pair<string, pkgutil::pkginfo_t> pkgutil::pkg_open(const string& filename) const result.second.version = version; archive = archive_read_new(); - archive_read_support_compression_all(archive); - archive_read_support_format_all(archive); + INIT_ARCHIVE(archive); if (archive_read_open_filename(archive, const_cast<char*>(filename.c_str()), @@ -382,8 +385,7 @@ void pkgutil::pkg_install(const string& filename, const set<string>& keep_list, unsigned int i; archive = archive_read_new(); - archive_read_support_compression_all(archive); - archive_read_support_format_all(archive); + INIT_ARCHIVE(archive); if (archive_read_open_filename(archive, const_cast<char*>(filename.c_str()), @@ -498,8 +500,7 @@ void pkgutil::pkg_footprint(string& filename) const // // FIXME the code duplication here is butt ugly archive = archive_read_new(); - archive_read_support_compression_all(archive); - archive_read_support_format_all(archive); + INIT_ARCHIVE(archive); if (archive_read_open_filename(archive, const_cast<char*>(filename.c_str()), @@ -526,8 +527,7 @@ void pkgutil::pkg_footprint(string& filename) const // Too bad, there doesn't seem to be a way to reuse our archive // instance archive = archive_read_new(); - archive_read_support_compression_all(archive); - archive_read_support_format_all(archive); + INIT_ARCHIVE(archive); if (archive_read_open_filename(archive, const_cast<char*>(filename.c_str()), |