[pacman-dev] [PATCH 7/7] Remove all usages of alpm_list_getdata() from the library

Dan McGee dan at archlinux.org
Mon Sep 19 16:13:17 EDT 2011


No need for the indirection; just access ->data instead.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/deps.c    |    3 ++-
 lib/libalpm/package.c |    2 +-
 lib/libalpm/sync.c    |    2 +-
 lib/libalpm/util.c    |    4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 0da20c1..08494a6 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -644,7 +644,8 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
 					providers, dep, NULL, &index);
 		}
 		if(index >= 0 && index < count) {
-			alpm_pkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index));
+			alpm_list_t *nth = alpm_list_nth(providers, index);
+			alpm_pkg_t *pkg = nth->data;
 			alpm_list_free(providers);
 			return pkg;
 		}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index ecea411..11bf01a 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -696,7 +696,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 = groups->next) {
-		char *grp = (char *)alpm_list_getdata(groups);
+		char *grp = groups->data;
 		if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
 			return 1;
 		}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index c6a79fa..732e786 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -767,7 +767,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas,
 	EVENT(handle, ALPM_EVENT_DELTA_INTEGRITY_START, NULL, NULL);
 
 	for(i = deltas; i; i = i->next) {
-		alpm_delta_t *d = alpm_list_getdata(i);
+		alpm_delta_t *d = i->data;
 		char *filepath = _alpm_filecache_find(handle, d->delta);
 
 		if(_alpm_test_checksum(filepath, d->delta_md5, ALPM_CSUM_MD5)) {
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index e2f2f44..a15eb96 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -652,7 +652,7 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename)
 
 	/* Loop through the cache dirs until we find a matching file */
 	for(i = handle->cachedirs; i; i = i->next) {
-		snprintf(path, PATH_MAX, "%s%s", (char *)alpm_list_getdata(i),
+		snprintf(path, PATH_MAX, "%s%s", (char *)i->data,
 				filename);
 		if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) {
 			retpath = strdup(path);
@@ -677,7 +677,7 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
 
 	/* Loop through the cache dirs until we find a usable directory */
 	for(i = handle->cachedirs; i; i = i->next) {
-		cachedir = alpm_list_getdata(i);
+		cachedir = i->data;
 		if(stat(cachedir, &buf) != 0) {
 			/* cache directory does not exist.... try creating it */
 			_alpm_log(handle, ALPM_LOG_WARNING, _("no %s cache exists, creating...\n"),
-- 
1.7.6.1



More information about the pacman-dev mailing list