summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-03-25 05:53:06 -0400
committerAllan McRae <allan@archlinux.org>2015-03-26 14:44:13 +1000
commitedeafcc988012615dbbb1cc9ac02090ad2dd8dac (patch)
tree104d0b27f1355f07ab22a312b6552fb78b9b09ec /lib/libalpm
parentbf3aec8c327528521b06befc8e9b6f55dd4fa07c (diff)
downloadpacman-edeafcc988012615dbbb1cc9ac02090ad2dd8dac.tar.xz
add_entry_to_files_list: pass filelist directly
Allows entries to be added to arbitrary filelists not connected to a package. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/be_package.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index e284254a..37aa428e 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -384,15 +384,16 @@ static int handle_simple_path(alpm_pkg_t *pkg, const char *path)
* @param path path of the file to be added
* @return <0 on error, 0 on success
*/
-static int add_entry_to_files_list(alpm_pkg_t *pkg, size_t *files_size,
- struct archive_entry *entry, const char *path)
+static int add_entry_to_files_list(alpm_filelist_t *filelist,
+ size_t *files_size, struct archive_entry *entry, const char *path)
{
- const size_t files_count = pkg->files.count;
+ const size_t files_count = filelist->count;
alpm_file_t *current_file;
mode_t type;
size_t pathlen;
- if(!_alpm_greedy_grow((void **)&pkg->files.files, files_size, (files_count + 1) * sizeof(alpm_file_t))) {
+ if(!_alpm_greedy_grow((void **)&filelist->files,
+ files_size, (files_count + 1) * sizeof(alpm_file_t))) {
return -1;
}
@@ -400,7 +401,7 @@ static int add_entry_to_files_list(alpm_pkg_t *pkg, size_t *files_size,
pathlen = strlen(path);
- current_file = pkg->files.files + files_count;
+ current_file = filelist->files + files_count;
/* mtree paths don't contain a tailing slash, those we get from
* the archive directly do (expensive way)
@@ -418,7 +419,7 @@ static int add_entry_to_files_list(alpm_pkg_t *pkg, size_t *files_size,
}
current_file->size = archive_entry_size(entry);
current_file->mode = archive_entry_mode(entry);
- pkg->files.count++;
+ filelist->count++;
return 0;
}
@@ -509,7 +510,7 @@ static int build_filelist_from_mtree(alpm_handle_t *handle, alpm_pkg_t *pkg, str
continue;
}
- if(add_entry_to_files_list(pkg, &files_size, mtree_entry, path) < 0) {
+ if(add_entry_to_files_list(&pkg->files, &files_size, mtree_entry, path) < 0) {
goto error;
}
}
@@ -617,7 +618,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
continue;
} else if(full && !hit_mtree) {
/* building the file list: expensive way */
- if(add_entry_to_files_list(newpkg, &files_size, entry, entry_name) < 0) {
+ if(add_entry_to_files_list(&newpkg->files, &files_size, entry, entry_name) < 0) {
goto error;
}
}