diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-04-20 19:46:53 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-04-20 19:46:53 +0000 |
commit | 406f3831927911643898f222cdc45ac8f1a6f6f6 (patch) | |
tree | 87be6e06a444c3fbd26268634d82fa1b75e24e83 | |
parent | b7d584feb68ebea877e65e248deca7af8aa4189a (diff) | |
download | pacman-406f3831927911643898f222cdc45ac8f1a6f6f6.tar.xz |
avoided two calls to db_scan() in checkdeps()
-rw-r--r-- | lib/libalpm/deps.c | 14 |
1 files 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) { |