From 6a6fc3107f477e579b0dd21553d48e073e3efdf4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 13:16:49 -0500 Subject: Move alpm filelists to a struct object This allows us to capture size and mode data when building filelists from package files. Future patches will take advantage of this newly available information, and frontends can use it as well. Signed-off-by: Dan McGee --- lib/libalpm/be_package.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/be_package.c') diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index a4c6c559..da5076e5 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -328,7 +328,12 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, * already been handled (for future possibilities) */ } else if(full) { /* Keep track of all files for filelist generation */ - newpkg->files = alpm_list_add(newpkg->files, strdup(entry_name)); + alpm_file_t *file; + CALLOC(file, 1, sizeof(alpm_file_t), goto error); + STRDUP(file->name, entry_name, goto error); + file->size = archive_entry_size(entry); + file->mode = archive_entry_mode(entry); + newpkg->files = alpm_list_add(newpkg->files, file); files_count++; } @@ -368,11 +373,14 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, if(full) { /* "checking for conflicts" requires a sorted list, ensure that here */ _alpm_log(handle, PM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile); - newpkg->files = alpm_list_msort(newpkg->files, files_count, _alpm_str_cmp); + newpkg->files = alpm_list_msort(newpkg->files, files_count, + _alpm_files_cmp); newpkg->infolevel = INFRQ_ALL; } else { /* get rid of any partial filelist we may have collected, it is invalid */ - FREELIST(newpkg->files); + alpm_list_free_inner(newpkg->files, (alpm_list_fn_free)_alpm_files_free); + alpm_list_free(newpkg->files); + newpkg->files = NULL; newpkg->infolevel = INFRQ_BASE | INFRQ_DESC; } -- cgit v1.2.3-24-g4f1b