From 103dbb9fd14fde35e116819808e6d4c9b534eaa2 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Tue, 13 Feb 2007 08:15:38 +0000 Subject: * Refactored conflict checking within packages. Profiling from Dan showed an unbelievable amount of strcmp() calls (25 million) due to the list searching. This has been reimplemented with a set-intersection scheme, due to the fact that file lists are always ordered. - NEEDS TESTING * Minor clean up, "globalized" the str_cmp helper to match the alpm comparison signature, so we can use it elsewhere. --- lib/libalpm/package.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index fa9f0f6b..fb7e5ee8 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -421,6 +421,10 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile) alpm_list_free(all_files); } + /* this is IMPORTANT - "checking for conflicts" requires a sorted list, so we + * ensure that here */ + info->files = alpm_list_msort(info->files, alpm_list_count(info->files), _alpm_str_cmp); + /* internal */ info->origin = PKG_FROM_FILE; info->data = strdup(pkgfile); -- cgit v1.2.3-54-g00ecf