summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-13 21:47:13 +0100
committerAurelien Foret <aurelien@archlinux.org>2006-01-13 21:47:13 +0100
commitca67579656f66e7dec61cf6c5c1ddde347b3134b (patch)
tree6eda80aa3cadb6c7747bcc791da2c4ee93eb8e88 /src
parent851dd3d16b72cbd285dc1dbeca7525ddcd01a63c (diff)
downloadpacman-ca67579656f66e7dec61cf6c5c1ddde347b3134b.tar.gz
pacman-ca67579656f66e7dec61cf6c5c1ddde347b3134b.tar.xz
code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/pacman/sync.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 74733e06..898f6050 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -566,6 +566,9 @@ int pacman_sync(list_t *targets)
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
PM_SYNCPKG *sync = alpm_list_getdata(lp);
+ PM_PKG *pkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
+ char *pkgname, *pkgver;
+
if((int)alpm_sync_getinfo(sync, PM_SYNC_TYPE) == PM_SYNC_TYPE_REPLACE) {
PM_LIST *j, *data;
data = alpm_sync_getinfo(sync, PM_SYNC_DATA);
@@ -577,6 +580,13 @@ int pacman_sync(list_t *targets)
}
}
}
+
+ pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
+ pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
+ totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
+
+ asprintf(&str, "%s-%s", pkgname, pkgver);
+ list_install = list_add(list_install, str);
}
if(list_remove) {
MSG(NL, "\nRemove: ");
@@ -586,18 +596,6 @@ int pacman_sync(list_t *targets)
FREELIST(list_remove);
FREE(str);
}
- for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
- char *pkgname, *pkgver;
- PM_SYNCPKG *sync = alpm_list_getdata(lp);
- PM_PKG *pkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
-
- pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
- pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
- totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
-
- asprintf(&str, "%s-%s", pkgname, pkgver);
- list_install = list_add(list_install, str);
- }
mb = (double)(totalsize / 1048576.0);
/* round up to 0.1 */
if(mb < 0.1) {
@@ -783,7 +781,6 @@ int pacman_sync(list_t *targets)
cleanup:
alpm_trans_release();
return(retval);
-
}
/* vim: set ts=2 sw=2 noet: */