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>
This commit is contained in:
Dan McGee 2012-01-02 12:52:00 -06:00
parent 496f7b4f64
commit eb5cb8ec02
1 changed files with 3 additions and 5 deletions

View File

@ -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);