From 77520f9d43ff94fc491b37f14922bb27408080e3 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 20 Apr 2005 19:40:33 +0000 Subject: avoided a call to db_scan() --- lib/libalpm/add.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 9ddf70de..64c06dc4 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -141,12 +141,12 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) { PMList *lp; - *data = NULL; - ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + *data = NULL; + /* Check dependencies */ @@ -272,11 +272,12 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) _alpm_log(PM_LOG_FLOW1, "upgrading package %s-%s", info->name, info->version); /* we'll need the full record for backup checks later */ + oldpkg = pkg_new(); + STRNCPY(oldpkg->name, info->name, PKG_NAME_LEN); + STRNCPY(oldpkg->version, info->version, PKG_VERSION_LEN); + oldpkg->backup = _alpm_list_strdup(info->backup); /* ORE - in fact, there's only a need for "version", "backup" and "reason" fields, - so we should only copy them from the cache, and thus save a call - to db_scan(ALL) */ - oldpkg = db_scan(db, info->name, INFRQ_ALL); + oldpkg->reason = info->reason;*/ /* pre_upgrade scriptlet */ if(info->scriptlet) { -- cgit v1.2.3-70-g09d2