Author: kkaempf Date: Thu Nov 13 12:33:19 2008 New Revision: 11675 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11675&view=rev Log: help iterator-less languages Modified: trunk/sat-solver/applayer/xsolvable.c trunk/sat-solver/applayer/xsolvable.h Modified: trunk/sat-solver/applayer/xsolvable.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/applayer/xsolvable.c?rev=11675&r1=11674&r2=11675&view=diff ============================================================================== --- trunk/sat-solver/applayer/xsolvable.c (original) +++ trunk/sat-solver/applayer/xsolvable.c Thu Nov 13 12:33:19 2008 @@ -327,6 +327,33 @@ } +/* + * count solvables in Repo + * This is the number of iterations in repo_xsolvables_iterate + */ + +int +repo_xsolvables_count( Repo *repo ) +{ + Solvable *s; + Id p; + int count = 0; + FOR_REPO_SOLVABLES(repo, p, s) + { + if (!s) + continue; + if (!s->name) + continue; + count++; + } + return count; +} + + +/* + * iterate over all solvables in Repo + */ + void repo_xsolvables_iterate( Repo *repo, int (*callback)( const XSolvable *xs, void *user_data ), void *user_data ) { Modified: trunk/sat-solver/applayer/xsolvable.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/applayer/xsolvable.h?rev=11675&r1=11674&r2=11675&view=diff ============================================================================== --- trunk/sat-solver/applayer/xsolvable.h (original) +++ trunk/sat-solver/applayer/xsolvable.h Thu Nov 13 12:33:19 2008 @@ -71,14 +71,6 @@ */ XSolvable *xsolvable_find( Pool *pool, char *name, const Repo *repo ); -/* - * Get XSolvable by index in pool (and repo) - * If repo == NULL, count index from beginning of pool - * If repo != NULL, count index from the given repo - */ -XSolvable *xsolvable_get( Pool *pool, int i, const Repo *repo ); - - /* iterate over all (newly-)to-be-installed solvables * if all = 0, only report *newly* installed ones (non-updates) * if all = 1, report all to-be-installed ones @@ -102,6 +94,12 @@ void solver_suggestions_iterate( Solver *solver, int (*callback)( const XSolvable *xs, void *user_data ), void *user_data ); /* + * Count solvables in a Repo + * This is the number of iterations when calling repo_xsolvables_iterate for this Repo + */ +int repo_xsolvables_count( Repo *repo ); + +/* * Iterate over all solvables of the given repo */ void repo_xsolvables_iterate( Repo *repo, int (*callback)( const XSolvable *xs, void *user_data ), void *user_data ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org