summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-02 13:26:30 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-01-02 13:26:30 +0000
commitdb0df44598eb04d391b90e8228b84f05c2ac88e2 (patch)
tree771e2dd7b5d7188fc88ab031501baf777febb89a
parentcd2daa51895976b6d5d9a99ba6ced0b547aab1d3 (diff)
downloadpacman-db0df44598eb04d391b90e8228b84f05c2ac88e2.tar.xz
code cleanup
-rw-r--r--lib/libalpm/add.c17
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--src/pacman/trans.c4
3 files changed, 9 insertions, 14 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 404e0619..e808bd37 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -150,13 +150,15 @@ int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
pmpkg_t *pkg = i->data;
if(strcmp(pkg->name, pkgname) == 0) {
if(versioncmp(pkg->version, pkgver) < 0) {
+ pmpkg_t *newpkg;
_alpm_log(PM_LOG_WARNING, "replacing older version of %s %s by %s in target list", pkg->name, pkg->version, pkgver);
- FREEPKG(i->data);
- i->data = pkg_load(name);
- if(i->data == NULL) {
+ newpkg = pkg_load(name);
+ if(newpkg == NULL) {
/* pm_errno is already set by pkg_load() */
goto error;
}
+ FREEPKG(i->data);
+ i->data = newpkg;
}
return(0);
}
@@ -245,11 +247,10 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
*data = pm_list_add(*data, miss);
}
}
+ FREELIST(lp);
if(errorout) {
- FREELIST(lp);
RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
}
- FREELIST(lp);
}
/* re-order w.r.t. dependencies */
@@ -695,11 +696,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
}
}
- if(pmo_upgrade) {
- EVENT(trans, PM_TRANS_EVT_UPGRADE_DONE, oldpkg, info);
- } else {
- EVENT(trans, PM_TRANS_EVT_ADD_DONE, info, NULL);
- }
+ EVENT(trans, (pmo_upgrade) ? PM_TRANS_EVT_UPGRADE_DONE : PM_TRANS_EVT_ADD_DONE, info, oldpkg);
FREEPKG(oldpkg);
}
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 3672442c..1e35ce38 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -29,8 +29,6 @@ extern "C" {
* Arch Linux Package Management library
*/
-/* #define PM_VERSION "0.1.0" */ /* Comes from autoconf's config.h */
-
#define PM_ROOT "/"
#define PM_DBPATH "var/lib/pacman"
#define PM_CACHEDIR "var/cache/pacman/pkg"
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index 6a997545..00c9d0e6 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -87,8 +87,8 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
MSG(CL, "done.\n");
snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)",
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
- (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION),
- (char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION));
+ (char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION),
+ (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str);
break;
}