From 0bc06918e4b93cae874c09f4b1d487865ca44fbd Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 30 Jan 2007 05:41:13 +0000 Subject: * Remove -fno-strict-aliasing as it is now unnecessary to compile. * Fix up add.c a bit better than it was in regards to FS #3492. * Optimized the sqrt call in dependency cycle checking to a single call. * Removal of an outdated comment. --- lib/libalpm/deps.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/libalpm/deps.c') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 0b4af443..0de9b930 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -106,6 +106,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode) int change = 1; int numscans = 0; int numtargs = 0; + int maxscans; if(targets == NULL) { return(NULL); @@ -116,15 +117,13 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode) numtargs++; } + maxscans = (int)sqrt(numtargs); + _alpm_log(PM_LOG_DEBUG, _("started sorting dependencies")); while(change) { alpm_list_t *tmptargs = NULL; change = 0; - /* TODO only use of a math.h function in entire libalpm, - * can we get rid of it? Former code line: - *if(numscans > numtargs) { - */ - if(numscans > sqrt(numtargs)) { + if(numscans > maxscans) { _alpm_log(PM_LOG_DEBUG, _("possible dependency cycle detected")); continue; } @@ -321,9 +320,9 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op, /* else if still not found... */ if(!found) { _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"), - depend.name, tp->name); + depend.name, tp->name); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, - depend.name, depend.version); + depend.name, depend.version); if(!_alpm_depmiss_isin(miss, baddeps)) { baddeps = alpm_list_add(baddeps, miss); } else { -- cgit v1.2.3-70-g09d2