diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-03 19:36:13 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-03 19:36:13 +0200 |
commit | 4015b23e8ef1e5a0e8d103ffefca0ffc4ad9e6c0 (patch) | |
tree | 276094dcabd0f8929b2b97c7befa0f40a2383c3b /lib/libalpm/diskspace.c | |
parent | 7fc635fee071e18d0422a4773937e66960be96b2 (diff) | |
download | pacman-4015b23e8ef1e5a0e8d103ffefca0ffc4ad9e6c0.tar.gz pacman-4015b23e8ef1e5a0e8d103ffefca0ffc4ad9e6c0.tar.xz |
Remove global handle from diskspace.c
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/diskspace.c')
-rw-r--r-- | lib/libalpm/diskspace.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index f864518e..c6c0b98f 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -51,9 +51,6 @@ #include "trans.h" #include "handle.h" -/* global handle variable */ -extern pmhandle_t *handle; - static int mount_point_cmp(const void *p1, const void *p2) { const alpm_mountpoint_t *mp1 = p1; @@ -151,8 +148,8 @@ static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points, return NULL; } -static int calculate_removed_size(const alpm_list_t *mount_points, - pmpkg_t *pkg) +static int calculate_removed_size(pmhandle_t *handle, + const alpm_list_t *mount_points, pmpkg_t *pkg) { alpm_list_t *file; @@ -188,8 +185,8 @@ static int calculate_removed_size(const alpm_list_t *mount_points, return 0; } -static int calculate_installed_size(const alpm_list_t *mount_points, - pmpkg_t *pkg) +static int calculate_installed_size(pmhandle_t *handle, + const alpm_list_t *mount_points, pmpkg_t *pkg) { int ret=0; struct archive *archive; @@ -260,13 +257,14 @@ cleanup: return ret; } -int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) +int _alpm_check_diskspace(pmhandle_t *handle) { alpm_list_t *mount_points, *i; alpm_mountpoint_t *root_mp; size_t replaces = 0, current = 0, numtargs; int abort = 0; alpm_list_t *targ; + pmtrans_t *trans = handle->trans; numtargs = alpm_list_count(trans->add); mount_points = mount_point_list(); @@ -291,7 +289,7 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) numtargs, current); local_pkg = targ->data; - calculate_removed_size(mount_points, local_pkg); + calculate_removed_size(handle, mount_points, local_pkg); } } @@ -303,11 +301,11 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) pkg = targ->data; /* is this package already installed? */ - local_pkg = _alpm_db_get_pkgfromcache(db_local, pkg->name); + local_pkg = _alpm_db_get_pkgfromcache(handle->db_local, pkg->name); if(local_pkg) { - calculate_removed_size(mount_points, local_pkg); + calculate_removed_size(handle, mount_points, local_pkg); } - calculate_installed_size(mount_points, pkg); + calculate_installed_size(handle, mount_points, pkg); for(i = mount_points; i; i = alpm_list_next(i)) { alpm_mountpoint_t *data = i->data; |