From 406f3831927911643898f222cdc45ac8f1a6f6f6 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 20 Apr 2005 19:46:53 +0000 Subject: avoided two calls to db_scan() in checkdeps() --- lib/libalpm/deps.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 5adb9d60..88bb6251 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -146,26 +146,25 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) * listed in the requiredby field. */ for(i = packages; i; i = i->next) { - pmpkg_t *tp, *oldpkg; - if(i->data == NULL) { + pmpkg_t *tp = i->data; + pmpkg_t *oldpkg; + if(tp == NULL) { continue; } - tp = (pmpkg_t *)i->data; - if((oldpkg = db_scan(db, tp->name, INFRQ_DESC | INFRQ_DEPENDS)) == NULL) { + if((oldpkg = db_get_pkgfromcache(db, tp->name)) == NULL) { continue; } for(j = oldpkg->requiredby; j; j = j->next) { char *ver; pmpkg_t *p; found = 0; - if((p = db_scan(db, j->data, INFRQ_DESC | INFRQ_DEPENDS)) == NULL) { + if((p = db_get_pkgfromcache(db, j->data)) == NULL) { /* hmmm... package isn't installed.. */ continue; } if(pkg_isin(p, packages)) { /* this package is also in the upgrade list, so don't worry about it */ - FREEPKG(p); continue; } for(k = p->depends; k && !found; k = k->next) { @@ -180,7 +179,6 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) PMList *provides = _alpm_db_whatprovides(db, depend.name); if(provides == NULL) { /* not found */ - FREEPKG(p); continue; } /* we found an installed package that provides depend.name */ @@ -218,9 +216,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) FREE(miss); } } - FREEPKG(p); } - FREEPKG(oldpkg); } } if(op == PM_TRANS_TYPE_ADD || op == PM_TRANS_TYPE_UPGRADE) { -- cgit v1.2.3-70-g09d2