summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-07-18 23:34:32 +1000
committerAllan McRae <allan@archlinux.org>2012-12-14 12:35:34 +1000
commit2fad78974d74338fa6bf895b8b092c38ab41bd10 (patch)
tree696cd534f8b7ac6e12b6527455ad74412e2be763 /lib/libalpm/package.c
parentc1abfeae1ec39a196262622662850b7d277a4734 (diff)
downloadpacman-2fad78974d74338fa6bf895b8b092c38ab41bd10.tar.xz
Add resolved_path to alpm_filelist_t
Add an array to hold the resolved paths of the files in alpm_filelist_t. When the file name and its resolved file name are identical, the pointer to the original file name is used to avoid duplicate memory allocation. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index a4c3309e..ab84329c 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -540,6 +540,9 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr)
}
}
newpkg->files.count = pkg->files.count;
+ /* deliberately do not copy resolved_path as this is only used
+ * during conflict checking and the sorting of list does not readily
+ * allow keeping its efficient memory usage when copying */
}
/* internal */
@@ -590,9 +593,15 @@ void _alpm_pkg_free(alpm_pkg_t *pkg)
if(pkg->files.count) {
size_t i;
for(i = 0; i < pkg->files.count; i++) {
- free(pkg->files.files[i].name);
+ FREE(pkg->files.files[i].name);
}
free(pkg->files.files);
+ if(pkg->files.resolved_path) {
+ for(i = 0; i < pkg->files.count; i++) {
+ free(pkg->files.resolved_path[i]);
+ }
+ free(pkg->files.resolved_path);
+ }
}
alpm_list_free_inner(pkg->backup, (alpm_list_fn_free)_alpm_backup_free);
alpm_list_free(pkg->backup);