mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Remove usages of alpm_list_next() in backend
Another function call that can be replaced by a single pointer dereference. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
c4bd476ad1
commit
5d291d050e
@ -230,7 +230,7 @@ static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
|
|||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
for(i = pkgs; i; i = alpm_list_next(i)) {
|
for(i = pkgs; i; i = i->next) {
|
||||||
alpm_pkg_t *pkg = i->data;
|
alpm_pkg_t *pkg = i->data;
|
||||||
if(_alpm_depcmp(pkg, dep)) {
|
if(_alpm_depcmp(pkg, dep)) {
|
||||||
return pkg;
|
return pkg;
|
||||||
|
@ -282,7 +282,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
}
|
}
|
||||||
calculate_installed_size(handle, mount_points, pkg);
|
calculate_installed_size(handle, mount_points, pkg);
|
||||||
|
|
||||||
for(i = mount_points; i; i = alpm_list_next(i)) {
|
for(i = mount_points; i; i = i->next) {
|
||||||
alpm_mountpoint_t *data = i->data;
|
alpm_mountpoint_t *data = i->data;
|
||||||
if(data->blocks_needed > data->max_blocks_needed) {
|
if(data->blocks_needed > data->max_blocks_needed) {
|
||||||
data->max_blocks_needed = data->blocks_needed;
|
data->max_blocks_needed = data->blocks_needed;
|
||||||
@ -293,7 +293,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", 100,
|
PROGRESS(trans, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", 100,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
for(i = mount_points; i; i = alpm_list_next(i)) {
|
for(i = mount_points; i; i = i->next) {
|
||||||
alpm_mountpoint_t *data = i->data;
|
alpm_mountpoint_t *data = i->data;
|
||||||
if(data->used && data->read_only) {
|
if(data->used && data->read_only) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("Partition %s is mounted read only\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("Partition %s is mounted read only\n"),
|
||||||
@ -318,7 +318,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = mount_points; i; i = alpm_list_next(i)) {
|
for(i = mount_points; i; i = i->next) {
|
||||||
alpm_mountpoint_t *data = i->data;
|
alpm_mountpoint_t *data = i->data;
|
||||||
FREE(data->mount_dir);
|
FREE(data->mount_dir);
|
||||||
}
|
}
|
||||||
|
@ -496,7 +496,7 @@ alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg)
|
|||||||
newpkg->reason = pkg->reason;
|
newpkg->reason = pkg->reason;
|
||||||
|
|
||||||
newpkg->licenses = alpm_list_strdup(pkg->licenses);
|
newpkg->licenses = alpm_list_strdup(pkg->licenses);
|
||||||
for(i = pkg->replaces; i; i = alpm_list_next(i)) {
|
for(i = pkg->replaces; i; i = i->next) {
|
||||||
newpkg->replaces = alpm_list_add(newpkg->replaces, _alpm_dep_dup(i->data));
|
newpkg->replaces = alpm_list_add(newpkg->replaces, _alpm_dep_dup(i->data));
|
||||||
}
|
}
|
||||||
newpkg->groups = alpm_list_strdup(pkg->groups);
|
newpkg->groups = alpm_list_strdup(pkg->groups);
|
||||||
@ -512,20 +512,20 @@ alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg)
|
|||||||
}
|
}
|
||||||
newpkg->files.count = pkg->files.count;
|
newpkg->files.count = pkg->files.count;
|
||||||
}
|
}
|
||||||
for(i = pkg->backup; i; i = alpm_list_next(i)) {
|
for(i = pkg->backup; i; i = i->next) {
|
||||||
newpkg->backup = alpm_list_add(newpkg->backup, _alpm_backup_dup(i->data));
|
newpkg->backup = alpm_list_add(newpkg->backup, _alpm_backup_dup(i->data));
|
||||||
}
|
}
|
||||||
for(i = pkg->depends; i; i = alpm_list_next(i)) {
|
for(i = pkg->depends; i; i = i->next) {
|
||||||
newpkg->depends = alpm_list_add(newpkg->depends, _alpm_dep_dup(i->data));
|
newpkg->depends = alpm_list_add(newpkg->depends, _alpm_dep_dup(i->data));
|
||||||
}
|
}
|
||||||
newpkg->optdepends = alpm_list_strdup(pkg->optdepends);
|
newpkg->optdepends = alpm_list_strdup(pkg->optdepends);
|
||||||
for(i = pkg->conflicts; i; i = alpm_list_next(i)) {
|
for(i = pkg->conflicts; i; i = i->next) {
|
||||||
newpkg->conflicts = alpm_list_add(newpkg->conflicts, _alpm_dep_dup(i->data));
|
newpkg->conflicts = alpm_list_add(newpkg->conflicts, _alpm_dep_dup(i->data));
|
||||||
}
|
}
|
||||||
for(i = pkg->provides; i; i = alpm_list_next(i)) {
|
for(i = pkg->provides; i; i = i->next) {
|
||||||
newpkg->provides = alpm_list_add(newpkg->provides, _alpm_dep_dup(i->data));
|
newpkg->provides = alpm_list_add(newpkg->provides, _alpm_dep_dup(i->data));
|
||||||
}
|
}
|
||||||
for(i = pkg->deltas; i; i = alpm_list_next(i)) {
|
for(i = pkg->deltas; i; i = i->next) {
|
||||||
newpkg->deltas = alpm_list_add(newpkg->deltas, _alpm_delta_dup(i->data));
|
newpkg->deltas = alpm_list_add(newpkg->deltas, _alpm_delta_dup(i->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* next see if the package is in a group that is ignored */
|
/* next see if the package is in a group that is ignored */
|
||||||
for(groups = handle->ignoregroup; groups; groups = alpm_list_next(groups)) {
|
for(groups = handle->ignoregroup; groups; groups = groups->next) {
|
||||||
char *grp = (char *)alpm_list_getdata(groups);
|
char *grp = (char *)alpm_list_getdata(groups);
|
||||||
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
|
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -638,7 +638,7 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename)
|
|||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
/* Loop through the cache dirs until we find a matching file */
|
/* Loop through the cache dirs until we find a matching file */
|
||||||
for(i = alpm_option_get_cachedirs(handle); i; i = alpm_list_next(i)) {
|
for(i = alpm_option_get_cachedirs(handle); i; i = i->next) {
|
||||||
snprintf(path, PATH_MAX, "%s%s", (char *)alpm_list_getdata(i),
|
snprintf(path, PATH_MAX, "%s%s", (char *)alpm_list_getdata(i),
|
||||||
filename);
|
filename);
|
||||||
if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) {
|
if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) {
|
||||||
@ -663,7 +663,7 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
|
|||||||
char *cachedir;
|
char *cachedir;
|
||||||
|
|
||||||
/* Loop through the cache dirs until we find a writeable dir */
|
/* Loop through the cache dirs until we find a writeable dir */
|
||||||
for(i = alpm_option_get_cachedirs(handle); i; i = alpm_list_next(i)) {
|
for(i = alpm_option_get_cachedirs(handle); i; i = i->next) {
|
||||||
cachedir = alpm_list_getdata(i);
|
cachedir = alpm_list_getdata(i);
|
||||||
if(stat(cachedir, &buf) != 0) {
|
if(stat(cachedir, &buf) != 0) {
|
||||||
/* cache directory does not exist.... try creating it */
|
/* cache directory does not exist.... try creating it */
|
||||||
|
Loading…
Reference in New Issue
Block a user