Remove alpm_list_getdata wrapper function

This one is pretty darn useless. Just derefence the ->data attribute
since the type is public anyway and save yourself the function call.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-10-06 00:55:47 -05:00
parent 1b7d2b0cfa
commit 6be492d2f7
14 changed files with 85 additions and 99 deletions

View file

@ -576,19 +576,6 @@ alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
} }
} }
/**
* @brief Get the data member of a list node.
*
* @param node the list node
*
* @return the contained data, or NULL if none
*/
void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
{
if(node == NULL) return NULL;
return node->data;
}
/* Misc */ /* Misc */
/** /**

View file

@ -71,7 +71,6 @@ alpm_list_t *alpm_list_nth(const alpm_list_t *list, size_t n);
alpm_list_t *alpm_list_next(const alpm_list_t *list); alpm_list_t *alpm_list_next(const alpm_list_t *list);
alpm_list_t *alpm_list_previous(const alpm_list_t *list); alpm_list_t *alpm_list_previous(const alpm_list_t *list);
alpm_list_t *alpm_list_last(const alpm_list_t *list); alpm_list_t *alpm_list_last(const alpm_list_t *list);
void *alpm_list_getdata(const alpm_list_t *entry);
/* misc */ /* misc */
size_t alpm_list_count(const alpm_list_t *list); size_t alpm_list_count(const alpm_list_t *list);

View file

@ -659,7 +659,7 @@ static int finish_section(struct section_t *section, int parse_options)
} }
for(i = section->servers; i; i = alpm_list_next(i)) { for(i = section->servers; i; i = alpm_list_next(i)) {
char *value = alpm_list_getdata(i); char *value = i->data;
if(_add_mirror(db, value) != 0) { if(_add_mirror(db, value) != 0) {
pm_printf(ALPM_LOG_ERROR, pm_printf(ALPM_LOG_ERROR,
_("could not add mirror '%s' to database '%s' (%s)\n"), _("could not add mirror '%s' to database '%s' (%s)\n"),

View file

@ -36,7 +36,7 @@ int pacman_deptest(alpm_list_t *targets)
alpm_db_t *localdb = alpm_option_get_localdb(config->handle); alpm_db_t *localdb = alpm_option_get_localdb(config->handle);
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
char *target = alpm_list_getdata(i); char *target = i->data;
if(!alpm_find_satisfier(alpm_db_get_pkgcache(localdb), target)) { if(!alpm_find_satisfier(alpm_db_get_pkgcache(localdb), target)) {
deps = alpm_list_add(deps, target); deps = alpm_list_add(deps, target);
@ -48,7 +48,7 @@ int pacman_deptest(alpm_list_t *targets)
} }
for(i = deps; i; i = alpm_list_next(i)) { for(i = deps; i; i = alpm_list_next(i)) {
const char *dep = alpm_list_getdata(i); const char *dep = i->data;
printf("%s\n", dep); printf("%s\n", dep);
} }

View file

@ -47,7 +47,7 @@ static void deplist_display(const char *title,
{ {
alpm_list_t *i, *text = NULL; alpm_list_t *i, *text = NULL;
for(i = deps; i; i = alpm_list_next(i)) { for(i = deps; i; i = alpm_list_next(i)) {
alpm_depend_t *dep = alpm_list_getdata(i); alpm_depend_t *dep = i->data;
text = alpm_list_add(text, alpm_dep_compute_string(dep)); text = alpm_list_add(text, alpm_dep_compute_string(dep));
} }
list_display(title, text); list_display(title, text);
@ -224,7 +224,7 @@ void dump_pkg_backups(alpm_pkg_t *pkg)
if(alpm_pkg_get_backup(pkg)) { if(alpm_pkg_get_backup(pkg)) {
/* package has backup files, so print them */ /* package has backup files, so print them */
for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) { for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) {
const alpm_backup_t *backup = alpm_list_getdata(i); const alpm_backup_t *backup = i->data;
const char *value; const char *value;
if(!backup->hash) { if(!backup->hash) {
continue; continue;

View file

@ -211,7 +211,7 @@ static void usage(int op, const char * const myname)
} }
list = alpm_list_msort(list, alpm_list_count(list), options_cmp); list = alpm_list_msort(list, alpm_list_count(list), options_cmp);
for (i = list; i; i = alpm_list_next(i)) { for (i = list; i; i = alpm_list_next(i)) {
printf("%s", (char *)alpm_list_getdata(i)); printf("%s", (const char *)i->data);
} }
alpm_list_free(list); alpm_list_free(list);
#undef addlist #undef addlist
@ -905,7 +905,7 @@ int main(int argc, char *argv[])
printf("DB Path : %s\n", alpm_option_get_dbpath(config->handle)); printf("DB Path : %s\n", alpm_option_get_dbpath(config->handle));
printf("Cache Dirs: "); printf("Cache Dirs: ");
for(i = alpm_option_get_cachedirs(config->handle); i; i = alpm_list_next(i)) { for(i = alpm_option_get_cachedirs(config->handle); i; i = alpm_list_next(i)) {
printf("%s ", (char *)alpm_list_getdata(i)); printf("%s ", (const char *)i->data);
} }
printf("\n"); printf("\n");
printf("Lock File : %s\n", alpm_option_get_lockfile(config->handle)); printf("Lock File : %s\n", alpm_option_get_lockfile(config->handle));

View file

@ -143,7 +143,7 @@ static int query_fileowner(alpm_list_t *targets)
alpm_list_t *i; alpm_list_t *i;
int found = 0; int found = 0;
filename = strdup(alpm_list_getdata(t)); filename = strdup(t->data);
if(lstat(filename, &buf) == -1) { if(lstat(filename, &buf) == -1) {
/* if it is not a path but a program name, then check in PATH */ /* if it is not a path but a program name, then check in PATH */
@ -193,7 +193,7 @@ static int query_fileowner(alpm_list_t *targets)
free(dname); free(dname);
for(i = alpm_db_get_pkgcache(db_local); i && !found; i = alpm_list_next(i)) { for(i = alpm_db_get_pkgcache(db_local); i && !found; i = alpm_list_next(i)) {
alpm_pkg_t *info = alpm_list_getdata(i); alpm_pkg_t *info = i->data;
alpm_filelist_t *filelist = alpm_pkg_get_files(info); alpm_filelist_t *filelist = alpm_pkg_get_files(info);
size_t j; size_t j;
@ -263,7 +263,7 @@ static int query_search(alpm_list_t *targets)
for(i = searchlist; i; i = alpm_list_next(i)) { for(i = searchlist; i; i = alpm_list_next(i)) {
alpm_list_t *grp; alpm_list_t *grp;
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
if(!config->quiet) { if(!config->quiet) {
printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
@ -277,7 +277,7 @@ static int query_search(alpm_list_t *targets)
alpm_list_t *k; alpm_list_t *k;
printf(" ("); printf(" (");
for(k = grp; k; k = alpm_list_next(k)) { for(k = grp; k; k = alpm_list_next(k)) {
const char *group = alpm_list_getdata(k); const char *group = k->data;
printf("%s", group); printf("%s", group);
if(alpm_list_next(k)) { if(alpm_list_next(k)) {
/* only print a spacer if there are more groups */ /* only print a spacer if there are more groups */
@ -304,33 +304,33 @@ static int query_search(alpm_list_t *targets)
static int query_group(alpm_list_t *targets) static int query_group(alpm_list_t *targets)
{ {
alpm_list_t *i, *j; alpm_list_t *i, *j;
char *grpname = NULL; const char *grpname = NULL;
int ret = 0; int ret = 0;
alpm_db_t *db_local = alpm_option_get_localdb(config->handle); alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
if(targets == NULL) { if(targets == NULL) {
for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) { for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) {
alpm_group_t *grp = alpm_list_getdata(j); alpm_group_t *grp = j->data;
const alpm_list_t *p; const alpm_list_t *p;
for(p = grp->packages; p; p = alpm_list_next(p)) { for(p = grp->packages; p; p = alpm_list_next(p)) {
alpm_pkg_t *pkg = alpm_list_getdata(p); alpm_pkg_t *pkg = p->data;
printf("%s %s\n", grp->name, alpm_pkg_get_name(pkg)); printf("%s %s\n", grp->name, alpm_pkg_get_name(pkg));
} }
} }
} else { } else {
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
alpm_group_t *grp; alpm_group_t *grp;
grpname = alpm_list_getdata(i); grpname = i->data;
grp = alpm_db_readgroup(db_local, grpname); grp = alpm_db_readgroup(db_local, grpname);
if(grp) { if(grp) {
const alpm_list_t *p; const alpm_list_t *p;
for(p = grp->packages; p; p = alpm_list_next(p)) { for(p = grp->packages; p; p = alpm_list_next(p)) {
if(!config->quiet) { if(!config->quiet) {
printf("%s %s\n", grpname, printf("%s %s\n", grpname,
alpm_pkg_get_name(alpm_list_getdata(p))); alpm_pkg_get_name(p->data));
} else { } else {
printf("%s\n", alpm_pkg_get_name(alpm_list_getdata(p))); printf("%s\n", alpm_pkg_get_name(p->data));
} }
} }
} else { } else {
@ -350,7 +350,7 @@ static int is_foreign(alpm_pkg_t *pkg)
int match = 0; int match = 0;
for(j = sync_dbs; j; j = alpm_list_next(j)) { for(j = sync_dbs; j; j = alpm_list_next(j)) {
alpm_db_t *db = alpm_list_getdata(j); alpm_db_t *db = j->data;
alpm_pkg_t *findpkg = alpm_db_get_pkg(db, pkgname); alpm_pkg_t *findpkg = alpm_db_get_pkg(db, pkgname);
if(findpkg) { if(findpkg) {
match = 1; match = 1;
@ -526,7 +526,7 @@ int pacman_query(alpm_list_t *targets)
} }
for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) { for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) {
pkg = alpm_list_getdata(i); pkg = i->data;
if(filter(pkg)) { if(filter(pkg)) {
int value = display(pkg); int value = display(pkg);
if(value != 0) { if(value != 0) {
@ -552,7 +552,7 @@ int pacman_query(alpm_list_t *targets)
/* operations on named packages in the local DB /* operations on named packages in the local DB
* valid: no-op (plain -Q), list, info, check */ * valid: no-op (plain -Q), list, info, check */
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
char *strname = alpm_list_getdata(i); const char *strname = i->data;
if(config->op_q_isfile) { if(config->op_q_isfile) {
alpm_pkg_load(config->handle, strname, 1, 0, &pkg); alpm_pkg_load(config->handle, strname, 1, 0, &pkg);

View file

@ -54,7 +54,7 @@ static int remove_target(const char *target)
return -1; return -1;
} }
for(p = grp->packages; p; p = alpm_list_next(p)) { for(p = grp->packages; p; p = alpm_list_next(p)) {
pkg = alpm_list_getdata(p); pkg = p->data;
if(alpm_remove_pkg(config->handle, pkg) == -1) { if(alpm_remove_pkg(config->handle, pkg) == -1) {
pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target,
alpm_strerror(alpm_errno(config->handle))); alpm_strerror(alpm_errno(config->handle)));
@ -89,7 +89,7 @@ int pacman_remove(alpm_list_t *targets)
/* Step 1: add targets to the created transaction */ /* Step 1: add targets to the created transaction */
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
char *target = alpm_list_getdata(i); char *target = i->data;
char *targ = strchr(target, '/'); char *targ = strchr(target, '/');
if(targ && strncmp(target, "local", 5) == 0) { if(targ && strncmp(target, "local", 5) == 0) {
targ++; targ++;
@ -110,13 +110,13 @@ int pacman_remove(alpm_list_t *targets)
switch(err) { switch(err) {
case ALPM_ERR_PKG_INVALID_ARCH: case ALPM_ERR_PKG_INVALID_ARCH:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
char *pkg = alpm_list_getdata(i); const char *pkg = i->data;
printf(_(":: package %s does not have a valid architecture\n"), pkg); printf(_(":: package %s does not have a valid architecture\n"), pkg);
} }
break; break;
case ALPM_ERR_UNSATISFIED_DEPS: case ALPM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
alpm_depmissing_t *miss = alpm_list_getdata(i); alpm_depmissing_t *miss = i->data;
char *depstring = alpm_dep_compute_string(miss->depend); char *depstring = alpm_dep_compute_string(miss->depend);
printf(_(":: %s: requires %s\n"), miss->target, depstring); printf(_(":: %s: requires %s\n"), miss->target, depstring);
free(depstring); free(depstring);
@ -133,7 +133,7 @@ int pacman_remove(alpm_list_t *targets)
/* Search for holdpkg in target list */ /* Search for holdpkg in target list */
int holdpkg = 0; int holdpkg = 0;
for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) { for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
if(alpm_list_find_str(config->holdpkg, alpm_pkg_get_name(pkg))) { if(alpm_list_find_str(config->holdpkg, alpm_pkg_get_name(pkg))) {
pm_printf(ALPM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"), pm_printf(ALPM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"),
alpm_pkg_get_name(pkg)); alpm_pkg_get_name(pkg));

View file

@ -95,7 +95,7 @@ static int sync_cleandb(const char *dbpath, int keep_used)
len = strlen(dname); len = strlen(dname);
char *dbname = strndup(dname, len - 3); char *dbname = strndup(dname, len - 3);
for(i = syncdbs; i && !found; i = alpm_list_next(i)) { for(i = syncdbs; i && !found; i = alpm_list_next(i)) {
alpm_db_t *db = alpm_list_getdata(i); alpm_db_t *db = i->data;
found = !strcmp(dbname, alpm_db_get_name(db)); found = !strcmp(dbname, alpm_db_get_name(db));
} }
free(dbname); free(dbname);
@ -155,7 +155,7 @@ static int sync_cleancache(int level)
int ret = 0; int ret = 0;
for(i = cachedirs; i; i = alpm_list_next(i)) { for(i = cachedirs; i; i = alpm_list_next(i)) {
printf(_("Cache directory: %s\n"), (char *)alpm_list_getdata(i)); printf(_("Cache directory: %s\n"), (const char *)i->data);
} }
if(!config->cleanmethod) { if(!config->cleanmethod) {
@ -183,7 +183,7 @@ static int sync_cleancache(int level)
} }
for(i = cachedirs; i; i = alpm_list_next(i)) { for(i = cachedirs; i; i = alpm_list_next(i)) {
const char *cachedir = alpm_list_getdata(i); const char *cachedir = i->data;
DIR *dir = opendir(cachedir); DIR *dir = opendir(cachedir);
struct dirent *ent; struct dirent *ent;
@ -253,7 +253,7 @@ static int sync_cleancache(int level)
alpm_list_t *j; alpm_list_t *j;
/* check if this package is in a sync DB */ /* check if this package is in a sync DB */
for(j = sync_dbs; j && delete; j = alpm_list_next(j)) { for(j = sync_dbs; j && delete; j = alpm_list_next(j)) {
alpm_db_t *db = alpm_list_getdata(j); alpm_db_t *db = j->data;
pkg = alpm_db_get_pkg(db, local_name); pkg = alpm_db_get_pkg(db, local_name);
if(pkg != NULL && alpm_pkg_vercmp(local_version, if(pkg != NULL && alpm_pkg_vercmp(local_version,
alpm_pkg_get_version(pkg)) == 0) { alpm_pkg_get_version(pkg)) == 0) {
@ -288,7 +288,7 @@ static int sync_synctree(int level, alpm_list_t *syncs)
int success = 0, ret; int success = 0, ret;
for(i = syncs; i; i = alpm_list_next(i)) { for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = alpm_list_getdata(i); alpm_db_t *db = i->data;
ret = alpm_db_update((level < 2 ? 0 : 1), db); ret = alpm_db_update((level < 2 ? 0 : 1), db);
if(ret < 0) { if(ret < 0) {
@ -337,7 +337,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
alpm_db_t *db_local = alpm_option_get_localdb(config->handle); alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
for(i = syncs; i; i = alpm_list_next(i)) { for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = alpm_list_getdata(i); alpm_db_t *db = i->data;
/* if we have a targets list, search for packages matching it */ /* if we have a targets list, search for packages matching it */
if(targets) { if(targets) {
ret = alpm_db_search(db, targets); ret = alpm_db_search(db, targets);
@ -353,7 +353,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
} }
for(j = ret; j; j = alpm_list_next(j)) { for(j = ret; j; j = alpm_list_next(j)) {
alpm_list_t *grp; alpm_list_t *grp;
alpm_pkg_t *pkg = alpm_list_getdata(j); alpm_pkg_t *pkg = j->data;
if(!config->quiet) { if(!config->quiet) {
printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
@ -367,7 +367,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
alpm_list_t *k; alpm_list_t *k;
printf(" ("); printf(" (");
for(k = grp; k; k = alpm_list_next(k)) { for(k = grp; k; k = alpm_list_next(k)) {
const char *group = alpm_list_getdata(k); const char *group = k->data;
printf("%s", group); printf("%s", group);
if(alpm_list_next(k)) { if(alpm_list_next(k)) {
/* only print a spacer if there are more groups */ /* only print a spacer if there are more groups */
@ -400,9 +400,9 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
if(targets) { if(targets) {
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
const char *grpname = alpm_list_getdata(i); const char *grpname = i->data;
for(j = syncs; j; j = alpm_list_next(j)) { for(j = syncs; j; j = alpm_list_next(j)) {
alpm_db_t *db = alpm_list_getdata(j); alpm_db_t *db = j->data;
alpm_group_t *grp = alpm_db_readgroup(db, grpname); alpm_group_t *grp = alpm_db_readgroup(db, grpname);
if(grp) { if(grp) {
@ -410,9 +410,9 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
for(k = grp->packages; k; k = alpm_list_next(k)) { for(k = grp->packages; k; k = alpm_list_next(k)) {
if(!config->quiet) { if(!config->quiet) {
printf("%s %s\n", grpname, printf("%s %s\n", grpname,
alpm_pkg_get_name(alpm_list_getdata(k))); alpm_pkg_get_name(k->data));
} else { } else {
printf("%s\n", alpm_pkg_get_name(alpm_list_getdata(k))); printf("%s\n", alpm_pkg_get_name(k->data));
} }
} }
} }
@ -420,15 +420,15 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
} }
} else { } else {
for(i = syncs; i; i = alpm_list_next(i)) { for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = alpm_list_getdata(i); alpm_db_t *db = i->data;
for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) { for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) {
alpm_group_t *grp = alpm_list_getdata(j); alpm_group_t *grp = j->data;
if(level > 1) { if(level > 1) {
for(k = grp->packages; k; k = alpm_list_next(k)) { for(k = grp->packages; k; k = alpm_list_next(k)) {
printf("%s %s\n", grp->name, printf("%s %s\n", grp->name,
alpm_pkg_get_name(alpm_list_getdata(k))); alpm_pkg_get_name(k->data));
} }
} else { } else {
/* print grp names only, no package names */ /* print grp names only, no package names */
@ -448,7 +448,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
if(targets) { if(targets) {
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
const char *target = alpm_list_getdata(i); const char *target = i->data;
char *name = strdup(target); char *name = strdup(target);
char *repo, *pkgstr; char *repo, *pkgstr;
int foundpkg = 0, founddb = 0; int foundpkg = 0, founddb = 0;
@ -464,14 +464,14 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
} }
for(j = syncs; j; j = alpm_list_next(j)) { for(j = syncs; j; j = alpm_list_next(j)) {
alpm_db_t *db = alpm_list_getdata(j); alpm_db_t *db = j->data;
if(repo && strcmp(repo, alpm_db_get_name(db)) != 0) { if(repo && strcmp(repo, alpm_db_get_name(db)) != 0) {
continue; continue;
} }
founddb = 1; founddb = 1;
for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) { for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) {
alpm_pkg_t *pkg = alpm_list_getdata(k); alpm_pkg_t *pkg = k->data;
if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) { if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) {
dump_pkg_full(pkg, config->op_s_info > 1); dump_pkg_full(pkg, config->op_s_info > 1);
@ -495,10 +495,10 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
} }
} else { } else {
for(i = syncs; i; i = alpm_list_next(i)) { for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = alpm_list_getdata(i); alpm_db_t *db = i->data;
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
alpm_pkg_t *pkg = alpm_list_getdata(j); alpm_pkg_t *pkg = j->data;
dump_pkg_full(pkg, config->op_s_info > 1); dump_pkg_full(pkg, config->op_s_info > 1);
} }
} }
@ -514,11 +514,11 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
if(targets) { if(targets) {
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
const char *repo = alpm_list_getdata(i); const char *repo = i->data;
alpm_db_t *db = NULL; alpm_db_t *db = NULL;
for(j = syncs; j; j = alpm_list_next(j)) { for(j = syncs; j; j = alpm_list_next(j)) {
alpm_db_t *d = alpm_list_getdata(j); alpm_db_t *d = j->data;
if(strcmp(repo, alpm_db_get_name(d)) == 0) { if(strcmp(repo, alpm_db_get_name(d)) == 0) {
db = d; db = d;
@ -540,10 +540,10 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
} }
for(i = ls; i; i = alpm_list_next(i)) { for(i = ls; i; i = alpm_list_next(i)) {
alpm_db_t *db = alpm_list_getdata(i); alpm_db_t *db = i->data;
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
alpm_pkg_t *pkg = alpm_list_getdata(j); alpm_pkg_t *pkg = j->data;
if(!config->quiet) { if(!config->quiet) {
printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
@ -569,7 +569,7 @@ static alpm_list_t *syncfirst(void) {
alpm_list_t *syncdbs = alpm_option_get_syncdbs(config->handle); alpm_list_t *syncdbs = alpm_option_get_syncdbs(config->handle);
for(i = config->syncfirst; i; i = alpm_list_next(i)) { for(i = config->syncfirst; i; i = alpm_list_next(i)) {
char *pkgname = alpm_list_getdata(i); const char *pkgname = i->data;
alpm_pkg_t *pkg = alpm_db_get_pkg(db_local, pkgname); alpm_pkg_t *pkg = alpm_db_get_pkg(db_local, pkgname);
if(pkg == NULL) { if(pkg == NULL) {
continue; continue;
@ -647,7 +647,7 @@ static int process_group(alpm_list_t *dbs, const char *group)
for(i = pkgs; i; i = alpm_list_next(i)) { for(i = pkgs; i; i = alpm_list_next(i)) {
if(array[n++] == 0) if(array[n++] == 0)
continue; continue;
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
if(process_pkg(pkg) == 1) { if(process_pkg(pkg) == 1) {
ret = 1; ret = 1;
@ -658,7 +658,7 @@ static int process_group(alpm_list_t *dbs, const char *group)
free(array); free(array);
} else { } else {
for(i = pkgs; i; i = alpm_list_next(i)) { for(i = pkgs; i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
if(process_pkg(pkg) == 1) { if(process_pkg(pkg) == 1) {
ret = 1; ret = 1;
@ -739,7 +739,7 @@ static int sync_trans(alpm_list_t *targets)
/* process targets */ /* process targets */
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
char *targ = alpm_list_getdata(i); const char *targ = i->data;
if(process_target(targ) == 1) { if(process_target(targ) == 1) {
trans_release(); trans_release();
return 1; return 1;
@ -772,13 +772,13 @@ int sync_prepare_execute(void)
switch(err) { switch(err) {
case ALPM_ERR_PKG_INVALID_ARCH: case ALPM_ERR_PKG_INVALID_ARCH:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
char *pkg = alpm_list_getdata(i); const char *pkg = i->data;
printf(_(":: package %s does not have a valid architecture\n"), pkg); printf(_(":: package %s does not have a valid architecture\n"), pkg);
} }
break; break;
case ALPM_ERR_UNSATISFIED_DEPS: case ALPM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
alpm_depmissing_t *miss = alpm_list_getdata(i); alpm_depmissing_t *miss = i->data;
char *depstring = alpm_dep_compute_string(miss->depend); char *depstring = alpm_dep_compute_string(miss->depend);
printf(_(":: %s: requires %s\n"), miss->target, depstring); printf(_(":: %s: requires %s\n"), miss->target, depstring);
free(depstring); free(depstring);
@ -786,7 +786,7 @@ int sync_prepare_execute(void)
break; break;
case ALPM_ERR_CONFLICTING_DEPS: case ALPM_ERR_CONFLICTING_DEPS:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
alpm_conflict_t *conflict = alpm_list_getdata(i); alpm_conflict_t *conflict = i->data;
/* only print reason if it contains new information */ /* only print reason if it contains new information */
if(conflict->reason->mod == ALPM_DEP_MOD_ANY) { if(conflict->reason->mod == ALPM_DEP_MOD_ANY) {
printf(_(":: %s and %s are in conflict\n"), printf(_(":: %s and %s are in conflict\n"),
@ -841,7 +841,7 @@ int sync_prepare_execute(void)
switch(err) { switch(err) {
case ALPM_ERR_FILE_CONFLICTS: case ALPM_ERR_FILE_CONFLICTS:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
alpm_fileconflict_t *conflict = alpm_list_getdata(i); alpm_fileconflict_t *conflict = i->data;
switch(conflict->type) { switch(conflict->type) {
case ALPM_FILECONFLICT_TARGET: case ALPM_FILECONFLICT_TARGET:
printf(_("%s exists in both '%s' and '%s'\n"), printf(_("%s exists in both '%s' and '%s'\n"),
@ -859,7 +859,7 @@ int sync_prepare_execute(void)
case ALPM_ERR_PKG_INVALID_SIG: case ALPM_ERR_PKG_INVALID_SIG:
case ALPM_ERR_DLT_INVALID: case ALPM_ERR_DLT_INVALID:
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
const char *filename = alpm_list_getdata(i); const char *filename = i->data;
printf(_("%s is invalid or corrupted\n"), filename); printf(_("%s is invalid or corrupted\n"), filename);
} }
break; break;

View file

@ -73,7 +73,7 @@ int pacman_upgrade(alpm_list_t *targets)
printf(_("loading packages...\n")); printf(_("loading packages...\n"));
/* add targets to the created transaction */ /* add targets to the created transaction */
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
char *targ = alpm_list_getdata(i); const char *targ = i->data;
alpm_pkg_t *pkg; alpm_pkg_t *pkg;
if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) { if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) {

View file

@ -400,7 +400,7 @@ char *strreplace(const char *str, const char *needle, const char *replace)
p = str; p = str;
newp = newstr; newp = newstr;
for(i = list; i; i = alpm_list_next(i)) { for(i = list; i; i = alpm_list_next(i)) {
q = alpm_list_getdata(i); q = i->data;
if(q > p) { if(q > p) {
/* add chars between this occurence and last occurence, if any */ /* add chars between this occurence and last occurence, if any */
memcpy(newp, p, (size_t)(q - p)); memcpy(newp, p, (size_t)(q - p));
@ -494,7 +494,7 @@ static void table_print_line(const alpm_list_t *line,
const alpm_list_t *curcell = line; const alpm_list_t *curcell = line;
while(curcell && curformat) { while(curcell && curformat) {
printf(alpm_list_getdata(curformat), alpm_list_getdata(curcell)); printf(curformat->data, curcell->data);
curcell = alpm_list_next(curcell); curcell = alpm_list_next(curcell);
curformat = alpm_list_next(curformat); curformat = alpm_list_next(curformat);
} }
@ -519,15 +519,15 @@ static alpm_list_t *table_create_format(const alpm_list_t *header,
} }
/* header determines column count and initial values of longest_strs */ /* header determines column count and initial values of longest_strs */
for(i = header, curcol = 0; i; i = alpm_list_next(i), curcol++) { for(i = header, curcol = 0; i; i = alpm_list_next(i), curcol++) {
colwidths[curcol] = string_length(alpm_list_getdata(i)); colwidths[curcol] = string_length(i->data);
} }
/* now find the longest string in each column */ /* now find the longest string in each column */
for(i = rows; i; i = alpm_list_next(i)) { for(i = rows; i; i = alpm_list_next(i)) {
/* grab first column of each row and iterate through columns */ /* grab first column of each row and iterate through columns */
const alpm_list_t *j = alpm_list_getdata(i); const alpm_list_t *j = i->data;
for(curcol = 0; j; j = alpm_list_next(j), curcol++) { for(curcol = 0; j; j = alpm_list_next(j), curcol++) {
char *str = alpm_list_getdata(j); const char *str = j->data;
size_t str_len = string_length(str); size_t str_len = string_length(str);
if(str_len > colwidths[curcol]) { if(str_len > colwidths[curcol]) {
@ -595,7 +595,7 @@ int table_display(const char *title, const alpm_list_t *header,
printf("\n"); printf("\n");
for(i = rows; i; i = alpm_list_next(i)) { for(i = rows; i; i = alpm_list_next(i)) {
table_print_line(alpm_list_getdata(i), formats); table_print_line(i->data, formats);
} }
FREELIST(formats); FREELIST(formats);
@ -617,11 +617,11 @@ void list_display(const char *title, const alpm_list_t *list)
} else { } else {
const unsigned short maxcols = getcols(); const unsigned short maxcols = getcols();
size_t cols = len; size_t cols = len;
const char *str = alpm_list_getdata(list); const char *str = list->data;
printf("%s", str); printf("%s", str);
cols += string_length(str); cols += string_length(str);
for(i = alpm_list_next(list); i; i = alpm_list_next(i)) { for(i = alpm_list_next(list); i; i = alpm_list_next(i)) {
str = alpm_list_getdata(i); str = i->data;
size_t s = string_length(str); size_t s = string_length(str);
/* wrap only if we have enough usable column space */ /* wrap only if we have enough usable column space */
if(maxcols > len && cols + s + 2 >= maxcols) { if(maxcols > len && cols + s + 2 >= maxcols) {
@ -657,7 +657,7 @@ void list_display_linebreak(const char *title, const alpm_list_t *list)
} else { } else {
const alpm_list_t *i; const alpm_list_t *i;
/* Print the first element */ /* Print the first element */
indentprint((const char *) alpm_list_getdata(list), len); indentprint((const char *)list->data, len);
printf("\n"); printf("\n");
/* Print the rest */ /* Print the rest */
for(i = alpm_list_next(list); i; i = alpm_list_next(i)) { for(i = alpm_list_next(list); i; i = alpm_list_next(i)) {
@ -665,7 +665,7 @@ void list_display_linebreak(const char *title, const alpm_list_t *list)
for(j = 1; j <= len; j++) { for(j = 1; j <= len; j++) {
printf(" "); printf(" ");
} }
indentprint((const char *) alpm_list_getdata(i), len); indentprint((const char *)i->data, len);
printf("\n"); printf("\n");
} }
} }
@ -832,7 +832,7 @@ static void _display_targets(alpm_list_t *targets, int verbose)
/* gather package info */ /* gather package info */
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
pm_target_t *target = alpm_list_getdata(i); pm_target_t *target = i->data;
if(target->install) { if(target->install) {
dlsize += alpm_pkg_download_size(target->install); dlsize += alpm_pkg_download_size(target->install);
@ -876,7 +876,7 @@ static void _display_targets(alpm_list_t *targets, int verbose)
/* rows is a list of lists of strings, free inner lists here */ /* rows is a list of lists of strings, free inner lists here */
for(i = rows; i; i = alpm_list_next(i)) { for(i = rows; i; i = alpm_list_next(i)) {
alpm_list_t *lp = alpm_list_getdata(i); alpm_list_t *lp = i->data;
FREELIST(lp); FREELIST(lp);
} }
alpm_list_free(rows); alpm_list_free(rows);
@ -933,7 +933,7 @@ void display_targets(void)
alpm_db_t *db_local = alpm_option_get_localdb(config->handle); alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
for(i = alpm_trans_get_add(config->handle); i; i = alpm_list_next(i)) { for(i = alpm_trans_get_add(config->handle); i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
pm_target_t *targ = calloc(1, sizeof(pm_target_t)); pm_target_t *targ = calloc(1, sizeof(pm_target_t));
if(!targ) return; if(!targ) return;
targ->install = pkg; targ->install = pkg;
@ -944,7 +944,7 @@ void display_targets(void)
targets = alpm_list_add(targets, targ); targets = alpm_list_add(targets, targ);
} }
for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) { for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
pm_target_t *targ = calloc(1, sizeof(pm_target_t)); pm_target_t *targ = calloc(1, sizeof(pm_target_t));
if(!targ) return; if(!targ) return;
targ->remove = pkg; targ->remove = pkg;
@ -979,7 +979,7 @@ static char *pkg_get_location(alpm_pkg_t *pkg)
case PM_OP_SYNC: case PM_OP_SYNC:
servers = alpm_db_get_servers(alpm_pkg_get_db(pkg)); servers = alpm_db_get_servers(alpm_pkg_get_db(pkg));
if(servers) { if(servers) {
pm_asprintf(&string, "%s/%s", alpm_list_getdata(servers), pm_asprintf(&string, "%s/%s", servers->data,
alpm_pkg_get_filename(pkg)); alpm_pkg_get_filename(pkg));
return string; return string;
} }
@ -1034,7 +1034,7 @@ void print_packages(const alpm_list_t *packages)
config->print_format = strdup("%l"); config->print_format = strdup("%l");
} }
for(i = packages; i; i = alpm_list_next(i)) { for(i = packages; i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
char *string = strdup(config->print_format); char *string = strdup(config->print_format);
char *temp = string; char *temp = string;
/* %n : pkgname */ /* %n : pkgname */
@ -1127,7 +1127,7 @@ void select_display(const alpm_list_t *pkglist)
const char *dbname = NULL; const char *dbname = NULL;
for (i = pkglist; i; i = i->next) { for (i = pkglist; i; i = i->next) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
alpm_db_t *db = alpm_pkg_get_db(pkg); alpm_db_t *db = alpm_pkg_get_db(pkg);
if(!dbname) if(!dbname)

View file

@ -56,10 +56,10 @@ static void checkpkgs(alpm_list_t *pkglist)
{ {
alpm_list_t *i, *j; alpm_list_t *i, *j;
for(i = pkglist; i; i = alpm_list_next(i)) { for(i = pkglist; i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i); alpm_pkg_t *pkg = i->data;
alpm_list_t *unused = alpm_pkg_unused_deltas(pkg); alpm_list_t *unused = alpm_pkg_unused_deltas(pkg);
for(j = unused; j; j = alpm_list_next(j)) { for(j = unused; j; j = alpm_list_next(j)) {
char *delta = alpm_list_getdata(j); const char *delta = j->data;
printf("%s\n", delta); printf("%s\n", delta);
} }
alpm_list_free(unused); alpm_list_free(unused);
@ -72,7 +72,7 @@ static void checkdbs(alpm_list_t *dbnames) {
const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL; const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
for(i = dbnames; i; i = alpm_list_next(i)) { for(i = dbnames; i; i = alpm_list_next(i)) {
const char *dbname = alpm_list_getdata(i); const char *dbname = i->data;
db = alpm_db_register_sync(handle, dbname, level); db = alpm_db_register_sync(handle, dbname, level);
if(db == NULL) { if(db == NULL) {
fprintf(stderr, "error: could not register sync database '%s' (%s)\n", fprintf(stderr, "error: could not register sync database '%s' (%s)\n",

View file

@ -363,7 +363,7 @@ static alpm_pkg_t *get_pkg_from_dbs(alpm_list_t *dbs, const char *needle) {
alpm_pkg_t *ret; alpm_pkg_t *ret;
for(i = dbs; i; i = alpm_list_next(i)) { for(i = dbs; i; i = alpm_list_next(i)) {
ret = alpm_db_get_pkg(alpm_list_getdata(i), needle); ret = alpm_db_get_pkg(i->data, needle);
if(ret) { if(ret) {
return ret; return ret;
} }
@ -386,7 +386,7 @@ static void walk_reverse_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, int depth)
required_by = alpm_pkg_compute_requiredby(pkg); required_by = alpm_pkg_compute_requiredby(pkg);
for(i = required_by; i; i = alpm_list_next(i)) { for(i = required_by; i; i = alpm_list_next(i)) {
const char *pkgname = alpm_list_getdata(i); const char *pkgname = i->data;
if(alpm_list_find_str(walked, pkgname)) { if(alpm_list_find_str(walked, pkgname)) {
/* if we've already seen this package, don't print in "unique" output /* if we've already seen this package, don't print in "unique" output
@ -417,7 +417,7 @@ static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, int depth)
walked = alpm_list_add(walked, (void *)alpm_pkg_get_name(pkg)); walked = alpm_list_add(walked, (void *)alpm_pkg_get_name(pkg));
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) { for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
alpm_depend_t *depend = alpm_list_getdata(i); alpm_depend_t *depend = i->data;
alpm_pkg_t *provider = alpm_find_dbs_satisfier(handle, dblist, depend->name); alpm_pkg_t *provider = alpm_find_dbs_satisfier(handle, dblist, depend->name);
if(provider) { if(provider) {

View file

@ -101,7 +101,7 @@ static int checkdeps(alpm_list_t *pkglist)
/* check dependencies */ /* check dependencies */
data = alpm_checkdeps(handle, pkglist, NULL, pkglist, 0); data = alpm_checkdeps(handle, pkglist, NULL, pkglist, 0);
for(i = data; i; i = alpm_list_next(i)) { for(i = data; i; i = alpm_list_next(i)) {
alpm_depmissing_t *miss = alpm_list_getdata(i); alpm_depmissing_t *miss = i->data;
char *depstring = alpm_dep_compute_string(miss->depend); char *depstring = alpm_dep_compute_string(miss->depend);
printf("missing dependency for %s : %s\n", miss->target, printf("missing dependency for %s : %s\n", miss->target,
depstring); depstring);
@ -119,7 +119,7 @@ static int checkconflicts(alpm_list_t *pkglist)
/* check conflicts */ /* check conflicts */
data = alpm_checkconflicts(handle, pkglist); data = alpm_checkconflicts(handle, pkglist);
for(i = data; i; i = i->next) { for(i = data; i; i = i->next) {
alpm_conflict_t *conflict = alpm_list_getdata(i); alpm_conflict_t *conflict = i->data;
printf("%s conflicts with %s\n", printf("%s conflicts with %s\n",
conflict->package1, conflict->package2); conflict->package1, conflict->package2);
ret++; ret++;
@ -154,7 +154,7 @@ static int check_syncdbs(alpm_list_t *dbnames)
const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL; const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
for(i = dbnames; i; i = alpm_list_next(i)) { for(i = dbnames; i; i = alpm_list_next(i)) {
char *dbname = alpm_list_getdata(i); const char *dbname = i->data;
db = alpm_db_register_sync(handle, dbname, level); db = alpm_db_register_sync(handle, dbname, level);
if(db == NULL) { if(db == NULL) {
fprintf(stderr, "error: could not register sync database (%s)\n", fprintf(stderr, "error: could not register sync database (%s)\n",