From: Michael Schroeder Date: Mon, 15 Jun 2009 16:29:53 +0000 (+0200) Subject: - add FOR_REPOS macro to iterate over repos X-Git-Tag: BASE-SuSE-Code-12_1-Branch~258 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6f5492739b5cc8fc52433ba13cdc6f3496fe333;p=platform%2Fupstream%2Flibsolv.git - add FOR_REPOS macro to iterate over repos --- diff --git a/src/pool.h b/src/pool.h index 1c54264..5dc813b 100644 --- a/src/pool.h +++ b/src/pool.h @@ -318,6 +318,12 @@ const char *pool_lookup_checksum(Pool *pool, Id entry, Id keyname, Id *typep); #define FOR_PROVIDES(v, vp, d) \ for (vp = pool_whatprovides(pool, d) ; (v = pool->whatprovidesdata[vp++]) != 0; ) +/* loop over all repositories */ +#define FOR_REPOS(rid, r) \ + for (rid = 0; rid < pool->nrepos; rid++) \ + if ((r = pool->repos[rid]) != 0) + + #define POOL_DEBUG(type, ...) do {if ((pool->debugmask & (type)) != 0) pool_debug(pool, (type), __VA_ARGS__);} while (0) #define IF_POOLDEBUG(type) if ((pool->debugmask & (type)) != 0) diff --git a/tools/dumpsolv.c b/tools/dumpsolv.c index aad1d24..cc6ce94 100644 --- a/tools/dumpsolv.c +++ b/tools/dumpsolv.c @@ -287,18 +287,16 @@ int main(int argc, char **argv) } #endif - for (j = 0; 1 && j < pool->nrepos; j++) + n = 0; + FOR_REPOS(j, repo) { - repo = pool->repos[j]; dump_repodata(repo); printf("repo %d contains %d solvables\n", j, repo->nsolvables); printf("repo start: %d end: %d\n", repo->start, repo->end); - for (i = repo->start, n = 1; i < repo->end; i++) + FOR_REPO_SOLVABLES(repo, i, s) { - s = pool->solvables + i; - if (s->repo != repo) - continue; + n++; printf("\n"); printf("solvable %d (%d):\n", n, i); #if 0 @@ -316,15 +314,11 @@ int main(int argc, char **argv) printids(repo, "enhances", s->enhances); if (repo->rpmdbid) printf("rpmdbid: %u\n", repo->rpmdbid[i - repo->start]); -#if 0 - dump_attrs (repo, n - 1); -#endif #endif dump_repoattrs(repo, i); #if 0 dump_some_attrs(repo, s); #endif - n++; } #if 0 tryme(repo, 0, SOLVABLE_MEDIANR, 0, 0);