mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
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:
parent
496f7b4f64
commit
eb5cb8ec02
@ -360,7 +360,7 @@ static int remove_package_files(alpm_handle_t *handle,
|
|||||||
{
|
{
|
||||||
alpm_list_t *skip_remove;
|
alpm_list_t *skip_remove;
|
||||||
alpm_filelist_t *filelist;
|
alpm_filelist_t *filelist;
|
||||||
size_t i, filenum = 0, position = 0;
|
size_t i;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int nosave = handle->trans->flags & ALPM_TRANS_FLAG_NOSAVE;
|
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);
|
FREELIST(skip_remove);
|
||||||
RET_ERR(handle, ALPM_ERR_PKG_CANT_REMOVE, -1);
|
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) {
|
if(!newpkg) {
|
||||||
/* init progress bar, but only on true remove transactions */
|
/* init progress bar, but only on true remove transactions */
|
||||||
@ -418,11 +417,10 @@ static int remove_package_files(alpm_handle_t *handle,
|
|||||||
|
|
||||||
if(!newpkg) {
|
if(!newpkg) {
|
||||||
/* update progress bar after each file */
|
/* 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,
|
PROGRESS(handle, ALPM_PROGRESS_REMOVE_START, oldpkg->name,
|
||||||
percent, pkg_count, targ_count);
|
percent, pkg_count, targ_count);
|
||||||
}
|
}
|
||||||
position++;
|
|
||||||
}
|
}
|
||||||
FREELIST(skip_remove);
|
FREELIST(skip_remove);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user