summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-10 03:36:42 +0100
committerDan McGee <dan@archlinux.org>2011-01-10 17:49:55 +0100
commitd03b57f459fb9ab9288991a70c4e7297a7c1d150 (patch)
tree6bebc7f9ca3c5414a48dc1b5cfa323fd5c00e372 /lib/libalpm/remove.c
parent281a4c0a4f2de217b5d23939fb78b3bbfccc34ca (diff)
downloadpacman-d03b57f459fb9ab9288991a70c4e7297a7c1d150.tar.gz
pacman-d03b57f459fb9ab9288991a70c4e7297a7c1d150.tar.xz
Remove need for floating point division in backend
All of these can be done with integer division; the only slightly interesting part is ensuring we round up like before with calling the ceil() function. We can also remove the math library from requirements; now that the only ceil() calls are gone, we don't need this anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index e1249fd6..d4e3b94a 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -425,14 +425,13 @@ int _alpm_remove_packages(pmtrans_t *trans, pmdb_t *db)
/* iterate through the list backwards, unlinking files */
newfiles = alpm_list_reverse(files);
for(lp = newfiles; lp; lp = alpm_list_next(lp)) {
- double percent;
+ int percent;
unlink_file(info, lp->data, NULL, trans->flags & PM_TRANS_FLAG_NOSAVE);
/* update progress bar after each file */
- percent = (double)position / (double)filenum;
+ percent = (position * 100) / filenum;
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name,
- (int)(percent * 100), pkg_count,
- (pkg_count - targcount + 1));
+ percent, pkg_count, (pkg_count - targcount + 1));
position++;
}
alpm_list_free(newfiles);