CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Moved archive initialization code to INIT_ARCHIVE.
authorTilman Sauerbeck <tilman@crux.nu>
Tue, 17 Apr 2007 18:49:58 +0000 (20:49 +0200)
committerTilman Sauerbeck <tilman@crux.nu>
Tue, 17 Apr 2007 18:49:58 +0000 (20:49 +0200)
pkgutil.cc

index 943c420f23a9d807b1fac599fc00dbe2a20899b3..00cedafab26c95ed795e96af8c4fd6d17196cc92 100644 (file)
 #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()),