summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/filelist.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2013-02-16 01:22:15 +0100
committerAllan McRae <allan@archlinux.org>2013-02-24 04:11:54 +0100
commit083ac51816323d69fcf2e271ccd52add3cdd6d22 (patch)
tree868f31977c4229cdf5801cb4e725d2ea96818176 /lib/libalpm/filelist.c
parent9995510dc81ab75fbb7ad7ca4fffedf8a5318bef (diff)
downloadpacman-083ac51816323d69fcf2e271ccd52add3cdd6d22.tar.gz
pacman-083ac51816323d69fcf2e271ccd52add3cdd6d22.tar.xz
return resolved paths from filelist_difference
We were comparing files based on resolved paths but returning the original file_t structures, which were not necessarily in the same order. The extra file_t information was only being used to determine if the file was a directory which can be accomplished by testing for a trailing slash, so just return the resolved path. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/filelist.c')
-rw-r--r--lib/libalpm/filelist.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c
index 5c5f017b..b0dcee4e 100644
--- a/lib/libalpm/filelist.c
+++ b/lib/libalpm/filelist.c
@@ -229,14 +229,13 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
size_t ctrA = 0, ctrB = 0;
while(ctrA < filesA->count && ctrB < filesB->count) {
- alpm_file_t *fileA = filesA->files + ctrA;
- const char *strA = filesA->resolved_path[ctrA];
- const char *strB = filesB->resolved_path[ctrB];
+ char *strA = filesA->resolved_path[ctrA];
+ char *strB = filesB->resolved_path[ctrB];
int cmp = strcmp(strA, strB);
if(cmp < 0) {
/* item only in filesA, qualifies as a difference */
- ret = alpm_list_add(ret, fileA);
+ ret = alpm_list_add(ret, strA);
ctrA++;
} else if(cmp > 0) {
ctrB++;
@@ -248,8 +247,7 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
/* ensure we have completely emptied pA */
while(ctrA < filesA->count) {
- alpm_file_t *fileA = filesA->files + ctrA;
- ret = alpm_list_add(ret, fileA);
+ ret = alpm_list_add(ret, filesA->resolved_path[ctrA]);
ctrA++;
}