From 083ac51816323d69fcf2e271ccd52add3cdd6d22 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Fri, 15 Feb 2013 19:22:15 -0500 Subject: 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 Signed-off-by: Allan McRae --- lib/libalpm/filelist.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/filelist.c') 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++; } -- cgit v1.2.3-24-g4f1b