diff options
author | Dan McGee <dan@archlinux.org> | 2012-01-02 19:52:00 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-01-02 19:58:51 +0100 |
commit | eb5cb8ec02bf31b4a5e84ea38c196dae67bf2aac (patch) | |
tree | 38a8b814a49878d067cf4489771adca46234dda9 /lib/libalpm | |
parent | 496f7b4f642af43beeafc1476294da56b433a587 (diff) | |
download | pacman-eb5cb8ec02bf31b4a5e84ea38c196dae67bf2aac.tar.gz pacman-eb5cb8ec02bf31b4a5e84ea38c196dae67bf2aac.tar.xz |
Remove unnecessary counters in file removal code
Now that filelist arrays know their own size, we don't need to do the
bookkeeping we used to do when they were linked lists. Remove some of
the counter variables and use math instead.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/remove.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index b43d1a62..f5c3c078 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -360,7 +360,7 @@ static int remove_package_files(alpm_handle_t *handle, { alpm_list_t *skip_remove; alpm_filelist_t *filelist; - size_t i, filenum = 0, position = 0; + size_t i; int err = 0; int nosave = handle->trans->flags & ALPM_TRANS_FLAG_NOSAVE; @@ -398,10 +398,9 @@ static int remove_package_files(alpm_handle_t *handle, FREELIST(skip_remove); RET_ERR(handle, ALPM_ERR_PKG_CANT_REMOVE, -1); } - filenum++; } - _alpm_log(handle, ALPM_LOG_DEBUG, "removing %zd files\n", filenum); + _alpm_log(handle, ALPM_LOG_DEBUG, "removing %zd files\n", filelist->count); if(!newpkg) { /* init progress bar, but only on true remove transactions */ @@ -418,11 +417,10 @@ static int remove_package_files(alpm_handle_t *handle, if(!newpkg) { /* update progress bar after each file */ - int percent = (position * 100) / filenum; + int percent = ((filelist->count - i) * 100) / filelist->count; PROGRESS(handle, ALPM_PROGRESS_REMOVE_START, oldpkg->name, percent, pkg_count, targ_count); } - position++; } FREELIST(skip_remove); |