[zypp-commit] r8690 - in /trunk/sat-solver/src: repo.c repo.h
Author: kkaempf Date: Thu Feb 14 17:09:57 2008 New Revision: 8690 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8690&view=rev Log: add a generic attribute lookup function 'repo_lookup' Modified: trunk/sat-solver/src/repo.c trunk/sat-solver/src/repo.h Modified: trunk/sat-solver/src/repo.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.c?rev=8690&r1=8689&r2=8690&view=diff ============================================================================== --- trunk/sat-solver/src/repo.c (original) +++ trunk/sat-solver/src/repo.c Thu Feb 14 17:09:57 2008 @@ -795,6 +795,33 @@ return 0; } + +/* + * generic attribute lookup + * returns non-zero if found + * zero if not found + */ + +int +repo_lookup(Solvable *s, Id key, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata) +{ + Repo *repo = s->repo; + Pool *pool = repo->pool; + Repodata *data; + int i, s_id; + + s_id = s - pool->solvables; + for (i = 0, data = repo->repodata; i < repo->nrepodata; i++, data++) + { + if (s_id < data->start || s_id >= data->end) + continue; + repodata_search (data, s_id - data->start, key, callback, cbdata); + return 1; + } + return 0; +} + + Repodata * repo_add_repodata(Repo *repo) { Modified: trunk/sat-solver/src/repo.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.h?rev=8690&r1=8689&r2=8690&view=diff ============================================================================== --- trunk/sat-solver/src/repo.h (original) +++ trunk/sat-solver/src/repo.h Thu Feb 14 17:09:57 2008 @@ -167,6 +167,9 @@ const char * repo_lookup_str(Solvable *s, Id key); /* returns the integer value of the attribute, or 0 if not found */ int repo_lookup_num(Solvable *s, Id key); +/* generic attribute lookup */ +int repo_lookup(Solvable *s, Id key, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata); + void repo_set_id(Repo *repo, Id p, Id keyname, Id id); void repo_set_num(Repo *repo, Id p, Id keyname, Id num); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
kkaempf@svn.opensuse.org