From c9984aa86ec99c6dd8d47c2bf3d7a409a1c4fa48 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Tue, 17 Apr 2007 20:49:58 +0200 Subject: [PATCH] Moved archive initialization code to INIT_ARCHIVE. --- pkgutil.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgutil.cc b/pkgutil.cc index 943c420..00cedaf 100644 --- a/pkgutil.cc +++ b/pkgutil.cc @@ -42,6 +42,10 @@ #include #include +#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 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(filename.c_str()), @@ -382,8 +385,7 @@ void pkgutil::pkg_install(const string& filename, const set& 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(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(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(filename.c_str()), -- 2.26.2