Make pmgrp_t public

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-06-16 11:55:26 -05:00
parent 51359e6d33
commit 25b7df4dab
7 changed files with 21 additions and 38 deletions

View File

@ -103,7 +103,6 @@ typedef enum _pgp_verify_t {
typedef struct __pmhandle_t pmhandle_t;
typedef struct __pmdb_t pmdb_t;
typedef struct __pmpkg_t pmpkg_t;
typedef struct __pmgrp_t pmgrp_t;
typedef struct __pmtrans_t pmtrans_t;
/** Dependency */
@ -137,6 +136,14 @@ typedef struct _pmfileconflict_t {
char *ctarget;
} pmfileconflict_t;
/** Package group */
typedef struct _pmgrp_t {
/** group name */
char *name;
/** list of pmpkg_t packages */
alpm_list_t *packages;
} pmgrp_t;
/** Package upgrade delta */
typedef struct _pmdelta_t {
/** filename of the delta patch */
@ -684,8 +691,7 @@ int alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify);
/*
* Groups
*/
const char *alpm_grp_get_name(const pmgrp_t *grp);
alpm_list_t *alpm_grp_get_pkgs(const pmgrp_t *grp);
alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name);
/*

View File

@ -52,16 +52,4 @@ void _alpm_grp_free(pmgrp_t *grp)
FREE(grp);
}
const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
{
ASSERT(grp != NULL, return NULL);
return grp->name;
}
alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(const pmgrp_t *grp)
{
ASSERT(grp != NULL, return NULL);
return grp->packages;
}
/* vim: set ts=2 sw=2 noet: */

View File

@ -22,13 +22,6 @@
#include "alpm.h"
struct __pmgrp_t {
/** group name */
char *name;
/** list of pmpkg_t packages */
alpm_list_t *packages;
};
pmgrp_t *_alpm_grp_new(const char *name);
void _alpm_grp_free(pmgrp_t *grp);

View File

@ -225,7 +225,7 @@ alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs,
if(!grp)
continue;
for(j = alpm_grp_get_pkgs(grp); j; j = j->next) {
for(j = grp->packages; j; j = j->next) {
pmpkg_t *pkg = j->data;
if(_alpm_pkg_find(ignorelist, alpm_pkg_get_name(pkg))) {

View File

@ -304,14 +304,11 @@ static int query_group(alpm_list_t *targets)
if(targets == NULL) {
for(j = alpm_db_get_grpcache(db_local); j; j = alpm_list_next(j)) {
pmgrp_t *grp = alpm_list_getdata(j);
const alpm_list_t *p, *packages;
const char *grpname;
const alpm_list_t *p;
grpname = alpm_grp_get_name(grp);
packages = alpm_grp_get_pkgs(grp);
for(p = packages; p; p = alpm_list_next(p)) {
printf("%s %s\n", grpname, alpm_pkg_get_name(alpm_list_getdata(p)));
for(p = grp->packages; p; p = alpm_list_next(p)) {
pmpkg_t *pkg = alpm_list_getdata(p);
printf("%s %s\n", grp->name, alpm_pkg_get_name(pkg));
}
}
} else {
@ -320,8 +317,8 @@ static int query_group(alpm_list_t *targets)
grpname = alpm_list_getdata(i);
grp = alpm_db_readgrp(db_local, grpname);
if(grp) {
const alpm_list_t *p, *packages = alpm_grp_get_pkgs(grp);
for(p = packages; p; p = alpm_list_next(p)) {
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)));

View File

@ -52,7 +52,7 @@ static int remove_target(const char *target)
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': target not found\n", target);
return -1;
}
for(p = alpm_grp_get_pkgs(grp); p; p = alpm_list_next(p)) {
for(p = grp->packages; p; p = alpm_list_next(p)) {
pmpkg_t *pkg = alpm_list_getdata(p);
if(alpm_remove_pkg(config->handle, pkg) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", target,

View File

@ -409,7 +409,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
if(grp) {
/* get names of packages in group */
for(k = alpm_grp_get_pkgs(grp); k; k = alpm_list_next(k)) {
for(k = grp->packages; k; k = alpm_list_next(k)) {
if(!config->quiet) {
printf("%s %s\n", grpname,
alpm_pkg_get_name(alpm_list_getdata(k)));
@ -426,16 +426,15 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
for(j = alpm_db_get_grpcache(db); j; j = alpm_list_next(j)) {
pmgrp_t *grp = alpm_list_getdata(j);
const char *grpname = alpm_grp_get_name(grp);
if(level > 1) {
for(k = alpm_grp_get_pkgs(grp); k; k = alpm_list_next(k)) {
printf("%s %s\n", grpname,
for(k = grp->packages; k; k = alpm_list_next(k)) {
printf("%s %s\n", grp->name,
alpm_pkg_get_name(alpm_list_getdata(k)));
}
} else {
/* print grp names only, no package names */
printf("%s\n", grpname);
printf("%s\n", grp->name);
}
}
}