summaryrefslogtreecommitdiffstats
path: root/src/pacman/query.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/query.c')
-rw-r--r--src/pacman/query.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c
index ab19bab2..66813e35 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
@@ -143,7 +141,7 @@ static int query_fileowner(alpm_list_t *targets)
alpm_list_t *i;
int found = 0;
- filename = strdup(alpm_list_getdata(t));
+ filename = strdup(t->data);
if(lstat(filename, &buf) == -1) {
/* if it is not a path but a program name, then check in PATH */
@@ -193,7 +191,7 @@ static int query_fileowner(alpm_list_t *targets)
free(dname);
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);
size_t j;
@@ -263,28 +261,28 @@ static int query_search(alpm_list_t *targets)
for(i = searchlist; i; i = alpm_list_next(i)) {
alpm_list_t *grp;
- alpm_pkg_t *pkg = alpm_list_getdata(i);
+ alpm_pkg_t *pkg = i->data;
if(!config->quiet) {
printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
} else {
- printf("%s", alpm_pkg_get_name(pkg));
+ fputs(alpm_pkg_get_name(pkg), stdout);
}
if(!config->quiet) {
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
alpm_list_t *k;
- printf(" (");
+ fputs(" (", stdout);
for(k = grp; k; k = alpm_list_next(k)) {
- const char *group = alpm_list_getdata(k);
- printf("%s", group);
+ const char *group = k->data;
+ fputs(group, stdout);
if(alpm_list_next(k)) {
/* only print a spacer if there are more groups */
- printf(" ");
+ putchar(' ');
}
}
- printf(")");
+ putchar(')');
}
/* we need a newline and initial indent first */
@@ -304,33 +302,33 @@ static int query_search(alpm_list_t *targets)
static int query_group(alpm_list_t *targets)
{
alpm_list_t *i, *j;
- char *grpname = NULL;
+ const char *grpname = NULL;
int ret = 0;
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
if(targets == NULL) {
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;
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));
}
}
} else {
for(i = targets; i; i = alpm_list_next(i)) {
alpm_group_t *grp;
- grpname = alpm_list_getdata(i);
+ grpname = i->data;
grp = alpm_db_readgroup(db_local, grpname);
if(grp) {
const alpm_list_t *p;
for(p = grp->packages; p; p = alpm_list_next(p)) {
if(!config->quiet) {
printf("%s %s\n", grpname,
- alpm_pkg_get_name(alpm_list_getdata(p)));
+ alpm_pkg_get_name(p->data));
} else {
- printf("%s\n", alpm_pkg_get_name(alpm_list_getdata(p)));
+ printf("%s\n", alpm_pkg_get_name(p->data));
}
}
} else {
@@ -350,7 +348,7 @@ static int is_foreign(alpm_pkg_t *pkg)
int match = 0;
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);
if(findpkg) {
match = 1;
@@ -526,7 +524,7 @@ int pacman_query(alpm_list_t *targets)
}
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)) {
int value = display(pkg);
if(value != 0) {
@@ -552,7 +550,7 @@ int pacman_query(alpm_list_t *targets)
/* operations on named packages in the local DB
* valid: no-op (plain -Q), list, info, check */
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) {
alpm_pkg_load(config->handle, strname, 1, 0, &pkg);