]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
compress: Move filelist argument into extractor struct
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 1 Sep 2022 18:03:35 +0000 (18:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 1 Sep 2022 18:03:35 +0000 (18:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/compress.c

index de311a6c94425e82635ff55f47a40dba3be761b7..c05a538032b1ae75fccd51a9dab7f010ad98ae07 100644 (file)
@@ -530,6 +530,9 @@ struct pakfire_extract {
        // The archive to extract
        struct archive* archive;
 
+       // The filelist of all extracted files
+       struct pakfire_filelist* filelist;
+
        // Prepend this prefix
        char prefix[PATH_MAX];
 
@@ -588,7 +591,7 @@ static void pakfire_extract_progress(void* p) {
 }
 
 static int __pakfire_extract_entry(struct pakfire* pakfire, struct pakfire_extract* data,
-               struct archive_entry* entry, struct pakfire_filelist* filelist) {
+               struct archive_entry* entry) {
        struct pakfire_file* file = NULL;
        char buffer[PATH_MAX];
        int r;
@@ -623,13 +626,13 @@ static int __pakfire_extract_entry(struct pakfire* pakfire, struct pakfire_extra
        }
 
        // Add entry to filelist (if requested)
-       if (filelist) {
+       if (data->filelist) {
                r = pakfire_file_create_from_archive_entry(&file, pakfire, entry);
                if (r)
                        goto ERROR;
 
                // Append the file to the list
-               r = pakfire_filelist_append(filelist, file);
+               r = pakfire_filelist_append(data->filelist, file);
                if (r)
                        goto ERROR;
        }
@@ -671,10 +674,11 @@ int pakfire_extract(struct pakfire* pakfire, struct archive* archive,
        int r = 1;
 
        struct pakfire_extract data = {
-               .pakfire = pakfire,
-               .archive = archive,
-               .flags   = flags,
-               .writer  = NULL,
+               .pakfire  = pakfire,
+               .archive  = archive,
+               .filelist = filelist,
+               .flags    = flags,
+               .writer   = NULL,
        };
 
        // Is this a dry run?
@@ -732,7 +736,7 @@ int pakfire_extract(struct pakfire* pakfire, struct archive* archive,
                }
 
                // Extract the entry
-               r = __pakfire_extract_entry(pakfire, &data, entry, filelist);
+               r = __pakfire_extract_entry(pakfire, &data, entry);
                if (r)
                        goto ERROR;
        }