[pacman-dev] [PATCH] Use pkgcache instead of db_scan in remove.c
Nagy Gabor
ngaba at bibl.u-szeged.hu
Fri Mar 28 12:08:48 EDT 2008
From 51abd287f9c40499f6985c3266441780a04c298c Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Fri, 28 Mar 2008 17:06:49 +0100
Subject: [PATCH] Use pkgcache instead of db_scan in remove.c
This should be a notable speed-up (apart from kernel cache).
Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
lib/libalpm/deps.c | 2 +-
lib/libalpm/remove.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 1eebca3..2d92179 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -506,7 +506,7 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
&& can_remove_package(db, deppkg, targs, include_explicit)) {
_alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets\n",
alpm_pkg_get_name(deppkg));
- /* add it to the target list */
+ /* add it to the target list */
targs = alpm_list_add(targs, _alpm_pkg_dup(deppkg));
}
}
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index dfdcabe..8d83294 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -61,7 +61,7 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
- if((info = _alpm_db_scan(db, name)) == NULL) {
+ if((info = _alpm_db_get_pkgfromcache(db, name)) == NULL) {
_alpm_log(PM_LOG_DEBUG, "could not find %s in database\n", name);
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
@@ -77,7 +77,7 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
_alpm_log(PM_LOG_DEBUG, "adding %s in the targets list\n", info->name);
- trans->packages = alpm_list_add(trans->packages, info);
+ trans->packages = alpm_list_add(trans->packages, _alpm_pkg_dup(info));
return(0);
}
@@ -107,12 +107,12 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
alpm_list_t *i;
for(i = lp; i; i = i->next) {
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
- pmpkg_t *info = _alpm_db_scan(db, miss->target);
+ pmpkg_t *info = _alpm_db_get_pkgfromcache(db, miss->target);
if(info) {
if(!_alpm_pkg_find(alpm_pkg_get_name(info), trans->packages)) {
_alpm_log(PM_LOG_DEBUG, "pulling %s in the targets list\n",
alpm_pkg_get_name(info));
- trans->packages = alpm_list_add(trans->packages, info);
+ trans->packages = alpm_list_add(trans->packages, _alpm_pkg_dup(info));
}
} else {
_alpm_log(PM_LOG_ERROR, _("could not find %s in database -- skipping\n"),
--
1.5.3.8
More information about the pacman-dev
mailing list