diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-06-29 22:38:57 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-06-30 13:28:59 -0400 |
commit | 27e3b5098d6c01d978cb5d530ea98f5f4069b25d (patch) | |
tree | eb609d3c262f03518ff570dbc311dc3261941019 /librazor | |
parent | 2d4487425bcbca6b4f0f86aaa8e2f276ec54c0a5 (diff) |
Get rid of razor_set_get_package().
This was always a silly little helper function, not general enough for
real world applications. Use an iterator to search through the set to
find the package of interest.
Diffstat (limited to 'librazor')
-rw-r--r-- | librazor/razor.c | 31 | ||||
-rw-r--r-- | librazor/razor.h | 3 |
2 files changed, 5 insertions, 29 deletions
diff --git a/librazor/razor.c b/librazor/razor.c index 6f5b1b5..d6f8331 100644 --- a/librazor/razor.c +++ b/librazor/razor.c @@ -383,26 +383,6 @@ razor_versioncmp(const char *s1, const char *s2) return *p1 - *p2; } -RAZOR_EXPORT struct razor_package * -razor_set_get_package(struct razor_set *set, const char *package) -{ - struct razor_package_iterator *pi; - struct razor_package *p; - const char *name; - - assert (set != NULL); - assert (package != NULL); - - pi = razor_package_iterator_create(set); - while (razor_package_iterator_next(pi, &p, RAZOR_DETAIL_NAME, &name, NULL)) { - if (strcmp(package, name) == 0) - break; - } - razor_package_iterator_destroy(pi); - - return p; -} - static const char * razor_package_get_details_type(struct razor_set *set, struct razor_package *package, @@ -676,20 +656,15 @@ list_package_files(struct razor_set *set, struct list *r, } RAZOR_EXPORT void -razor_set_list_package_files(struct razor_set *set, const char *name) +razor_set_list_package_files(struct razor_set *set, + struct razor_package *package) { - struct razor_package *package; struct list *r; uint32_t end; char buffer[512]; assert (set != NULL); - assert (name != NULL); - - package = razor_set_get_package(set, name); - /* TODO: we should return the error to the caller */ - if (!package) - return; + assert (package != NULL); r = list_first(&package->files, &set->file_pool); end = set->files.size / sizeof (struct razor_entry); diff --git a/librazor/razor.h b/librazor/razor.h index 488b4ed..096aa31 100644 --- a/librazor/razor.h +++ b/librazor/razor.h @@ -181,7 +181,8 @@ void razor_property_iterator_destroy(struct razor_property_iterator *pi); void razor_set_list_files(struct razor_set *set, const char *prefix); -void razor_set_list_package_files(struct razor_set *set, const char *name); +void razor_set_list_package_files(struct razor_set *set, + struct razor_package *package); enum razor_diff_action { RAZOR_DIFF_ACTION_ADD, |