summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-18 00:28:53 -0500
committerDan McGee <dan@archlinux.org>2011-08-18 10:47:41 -0500
commit5d291d050ebd714851c6bd85efd49a03d88414f0 (patch)
treebf8acfd686e0040b22da93aa61c22548cff07ef5
parentc4bd476ad13e142fe8323fe74d84b3950b53da17 (diff)
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>
-rw-r--r--lib/libalpm/deps.c2
-rw-r--r--lib/libalpm/diskspace.c6
-rw-r--r--lib/libalpm/package.c14
-rw-r--r--lib/libalpm/util.c4
4 files changed, 13 insertions, 13 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 6869087c..de9ae44c 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -230,7 +230,7 @@ static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
{
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;
if(_alpm_depcmp(pkg, dep)) {
return pkg;
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 4e7ffaad..1e2fa143 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -282,7 +282,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
}
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;
if(data->blocks_needed > data->max_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,
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;
if(data->used && data->read_only) {
_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;
FREE(data->mount_dir);
}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index a31effbc..d865ac95 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -496,7 +496,7 @@ alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg)
newpkg->reason = pkg->reason;
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->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;
}
- 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));
}
- 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->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));
}
- 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));
}
- 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));
}
@@ -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 */
- 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);
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
return 1;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 4dc0fbe7..27709c64 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -638,7 +638,7 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename)
struct stat buf;
/* 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),
filename);
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;
/* 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);
if(stat(cachedir, &buf) != 0) {
/* cache directory does not exist.... try creating it */