diff options
author | Richard Hughes <richard@hughsie.com> | 2008-07-01 09:22:25 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2008-07-01 09:22:25 +0100 |
commit | a6a8f407fb539a884a132f3289919aeb4a8d78df (patch) | |
tree | a6accbfdef755d24f248e73231fdc67ee9cb4393 /librazor | |
parent | 27e3b5098d6c01d978cb5d530ea98f5f4069b25d (diff) |
convert the NULL sentinel to RAZOR_DETAIL_LAST
Diffstat (limited to 'librazor')
-rw-r--r-- | librazor/iterator.c | 6 | ||||
-rw-r--r-- | librazor/razor.c | 14 | ||||
-rw-r--r-- | librazor/razor.h | 16 | ||||
-rw-r--r-- | librazor/transaction.c | 24 |
4 files changed, 32 insertions, 28 deletions
diff --git a/librazor/iterator.c b/librazor/iterator.c index 6b973b0..4908d53 100644 --- a/librazor/iterator.c +++ b/librazor/iterator.c @@ -114,7 +114,9 @@ razor_package_iterator_create_for_file(struct razor_set *set, * Gets the next iteratr along with any vararg data. * The vararg must be terminated with NULL. * - * Example: razor_package_iterator_next (pi, package, RAZOR_DETAIL_NAME, &name, 0); + * Example: razor_package_iterator_next (pi, package, + * RAZOR_DETAIL_NAME, &name, + * RAZOR_DETAIL_LAST); **/ RAZOR_EXPORT int razor_package_iterator_next(struct razor_package_iterator *pi, @@ -273,7 +275,7 @@ razor_package_query_add_iterator(struct razor_package_query *pq, assert (pi != NULL); packages = pq->set->packages.data; - while (razor_package_iterator_next(pi, &p, NULL)) { + while (razor_package_iterator_next(pi, &p, RAZOR_DETAIL_LAST)) { pq->count += pq->vector[p - packages] ^ 1; pq->vector[p - packages] = 1; } diff --git a/librazor/razor.c b/librazor/razor.c index d6f8331..7d18205 100644 --- a/librazor/razor.c +++ b/librazor/razor.c @@ -442,7 +442,7 @@ razor_package_get_details_varg(struct razor_set *set, for (i = 0;; i += 2) { type = va_arg(args, enum razor_detail_type); - if (type == 0) + if (type == RAZOR_DETAIL_LAST) break; data = va_arg(args, const char **); *data = razor_package_get_details_type(set, package, type); @@ -458,7 +458,9 @@ razor_package_get_details_varg(struct razor_set *set, * Gets details about a package using a varg interface * The vararg must be terminated with %NULL. * - * Example: razor_package_get_details (set, package, RAZOR_DETAIL_URL, &url, 0); + * Example: razor_package_get_details (set, package, + * RAZOR_DETAIL_URL, &url, + * RAZOR_DETAIL_LAST); **/ RAZOR_EXPORT void razor_package_get_details(struct razor_set *set, struct razor_package *package, ...) @@ -696,12 +698,12 @@ razor_set_diff(struct razor_set *set, struct razor_set *upstream, RAZOR_DETAIL_NAME, &name1, RAZOR_DETAIL_VERSION, &version1, RAZOR_DETAIL_ARCH, &arch1, - NULL); + RAZOR_DETAIL_LAST); razor_package_iterator_next(pi2, &p2, RAZOR_DETAIL_NAME, &name2, RAZOR_DETAIL_VERSION, &version2, RAZOR_DETAIL_ARCH, &arch2, - NULL); + RAZOR_DETAIL_LAST); while (p1 || p2) { if (p1 && p2) { @@ -724,13 +726,13 @@ razor_set_diff(struct razor_set *set, struct razor_set *upstream, RAZOR_DETAIL_NAME, &name1, RAZOR_DETAIL_VERSION, &version1, RAZOR_DETAIL_ARCH, &arch1, - NULL); + RAZOR_DETAIL_LAST); if (p2 != NULL && res >= 0) razor_package_iterator_next(pi2, &p2, RAZOR_DETAIL_NAME, &name2, RAZOR_DETAIL_VERSION, &version2, RAZOR_DETAIL_ARCH, &arch2, - NULL); + RAZOR_DETAIL_LAST); } razor_package_iterator_destroy(pi1); diff --git a/librazor/razor.h b/librazor/razor.h index 096aa31..6cf1d8f 100644 --- a/librazor/razor.h +++ b/librazor/razor.h @@ -22,13 +22,6 @@ #include <stdint.h> -/* GCC sentinel */ -#if defined(__GNUC__) && __GNUC__ >= 4 -#define RAZOR_SENTINEL __attribute__ ((__sentinel__(0))); -#else -#define RAZOR_SENTINEL -#endif - enum razor_repo_file_type { RAZOR_REPO_FILE_MAIN, RAZOR_REPO_FILE_DETAILS, @@ -36,7 +29,8 @@ enum razor_repo_file_type { }; enum razor_detail_type { - RAZOR_DETAIL_NAME = 1, /* NULL (0 on 32 bit) is the sentinel */ + RAZOR_DETAIL_LAST = 0, /* the sentinel */ + RAZOR_DETAIL_NAME, RAZOR_DETAIL_VERSION, RAZOR_DETAIL_ARCH, RAZOR_DETAIL_SUMMARY, @@ -102,8 +96,7 @@ razor_set_get_package(struct razor_set *set, const char *package); void razor_package_get_details(struct razor_set *set, - struct razor_package *package, ...) - RAZOR_SENTINEL; + struct razor_package *package, ...); /** @@ -153,8 +146,7 @@ razor_package_iterator_create_for_file(struct razor_set *set, const char *filename); int razor_package_iterator_next(struct razor_package_iterator *pi, - struct razor_package **package, ...) - RAZOR_SENTINEL; + struct razor_package **package, ...); void razor_package_iterator_destroy(struct razor_package_iterator *pi); struct razor_package_query * diff --git a/librazor/transaction.c b/librazor/transaction.c index 1e91cae..0abd6e1 100644 --- a/librazor/transaction.c +++ b/librazor/transaction.c @@ -318,7 +318,8 @@ remove_matching_providers(struct razor_transaction *trans, razor_package_iterator_init_for_property(&pkg_iter, set, p); while (razor_package_iterator_next(&pkg_iter, &pkg, RAZOR_DETAIL_NAME, &n, - RAZOR_DETAIL_VERSION, &v, NULL)) { + RAZOR_DETAIL_VERSION, &v, + RAZOR_DETAIL_LAST)) { fprintf(stderr, "removing %s-%s\n", n, v); razor_transaction_remove_package(trans, pkg); } @@ -364,7 +365,8 @@ flag_matching_providers(struct razor_transaction *trans, razor_package_iterator_init_for_property(&pkg_iter, set, p); while (razor_package_iterator_next(&pkg_iter, &pkg, RAZOR_DETAIL_NAME, &name, - RAZOR_DETAIL_VERSION, &version, NULL)) { + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_LAST)) { fprintf(stderr, "flagging %s-%s for providing %s matching %s %s\n", name, version, @@ -526,7 +528,8 @@ update_unsatisfied_packages(struct razor_transaction *trans) trans->system.set, sp); while (razor_package_iterator_next(&pkg_iter, &pkg, - RAZOR_DETAIL_NAME, &name, NULL)) { + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_LAST)) { fprintf(stderr, "updating %s because %s %s %s " "isn't satisfied\n", name, spi.pool + sp->name, @@ -578,7 +581,8 @@ update_conflicted_packages(struct razor_transaction *trans) sp); while (razor_package_iterator_next(&pkg_iter, &pkg, RAZOR_DETAIL_NAME, &name, - RAZOR_DETAIL_VERSION, &version, NULL)) { + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_LAST)) { fprintf(stderr, "updating %s %s because it " "conflicts with %s\n", name, version, spi.pool + sp->name); @@ -668,7 +672,8 @@ flush_scheduled_system_updates(struct razor_transaction *trans) while (razor_package_iterator_next(pi, &p, RAZOR_DETAIL_NAME, &name, - RAZOR_DETAIL_VERSION, &version, NULL)) { + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_LAST)) { if (!(trans->system.packages[p - spkgs] & TRANS_PACKAGE_UPDATE)) continue; @@ -705,7 +710,8 @@ flush_scheduled_upstream_updates(struct razor_transaction *trans) while (razor_package_iterator_next(pi, &p, RAZOR_DETAIL_NAME, &name, - RAZOR_DETAIL_VERSION, &version, NULL)) { + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_LAST)) { if (!(trans->upstream.packages[p - upkgs] & TRANS_PACKAGE_UPDATE)) continue; @@ -754,7 +760,8 @@ describe_unsatisfied(struct razor_set *set, struct razor_property *rp) while (razor_package_iterator_next(&pi, &pkg, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) fprintf(stderr, "%s is needed by %s-%s.%s\n", &pool[rp->name], name, version, arch); @@ -763,7 +770,8 @@ describe_unsatisfied(struct razor_set *set, struct razor_property *rp) while (razor_package_iterator_next(&pi, &pkg, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) fprintf(stderr, "%s %s %s is needed by %s-%s.%s\n", &pool[rp->name], razor_property_relation_to_string(rp), |