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/remove.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'lib/libalpm/remove.c') diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index f230dfa7..7aaae2e6 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -155,14 +155,6 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) return(0); } -/* Helper function for comparing strings - */ -static int str_cmp(const void *s1, const void *s2) -{ - return(strcmp(s1, s2)); -} - - static int can_remove_file(const char *path) { alpm_list_t *i; @@ -378,7 +370,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db) /* Ensure package has the appropriate data */ _alpm_db_read(db, INFRQ_DEPENDS, depinfo); /* splice out this entry from requiredby */ - depinfo->requiredby = alpm_list_remove(depinfo->requiredby, info->name, str_cmp, &vdata); + depinfo->requiredby = alpm_list_remove(depinfo->requiredby, info->name, _alpm_str_cmp, &vdata); data = vdata; FREE(data); _alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), depinfo->name); -- cgit v1.2.3-24-g4f1b