- add FOR_REPOS macro to iterate over repos
authorMichael Schroeder <mls@suse.de>
Mon, 15 Jun 2009 16:29:53 +0000 (18:29 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 15 Jun 2009 16:29:53 +0000 (18:29 +0200)
src/pool.h
tools/dumpsolv.c

index 1c54264..5dc813b 100644 (file)
@@ -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)
 
index aad1d24..cc6ce94 100644 (file)
@@ -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);