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 /src | |
parent | 27e3b5098d6c01d978cb5d530ea98f5f4069b25d (diff) |
convert the NULL sentinel to RAZOR_DETAIL_LAST
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 40 | ||||
-rw-r--r-- | src/rpm.c | 17 | ||||
-rw-r--r-- | src/test-driver.c | 5 |
3 files changed, 42 insertions, 20 deletions
@@ -61,7 +61,9 @@ create_iterator_from_argv(struct razor_set *set, int argc, const char *argv[]) iter = razor_package_iterator_create(set); pattern = argv[i]; count = 0; - while (razor_package_iterator_next(iter, &package, RAZOR_DETAIL_NAME, &name, NULL)) { + while (razor_package_iterator_next(iter, &package, + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_LAST)) { if (fnmatch(pattern, name, 0) != 0) continue; @@ -89,7 +91,8 @@ list_packages(struct razor_package_iterator *iter, uint32_t flags) while (razor_package_iterator_next(iter, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { if (flags & LIST_PACKAGES_ONLY_NAMES) printf("%s\n", name); else @@ -167,7 +170,10 @@ list_properties(int argc, const char *argv[], uint32_t type) set = razor_set_open(repo_filename); pi = create_iterator_from_argv(set, argc, argv); while (razor_package_iterator_next(pi, &package, - &name, &version, &arch)) + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) list_package_properties(set, package, type); razor_package_iterator_destroy(pi); razor_set_destroy(set); @@ -253,7 +259,10 @@ command_list_package_files(int argc, const char *argv[]) pi = create_iterator_from_argv(set, argc, argv); while (razor_package_iterator_next(pi, &package, - &name, &version, &arch)) + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) razor_set_list_package_files(set, package); razor_package_iterator_destroy(pi); @@ -445,7 +454,8 @@ mark_packages_for_update(struct razor_transaction *trans, pi = razor_package_iterator_create(set); while (razor_package_iterator_next(pi, &package, - RAZOR_DETAIL_NAME, &name, NULL)) { + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_LAST)) { if (pattern && fnmatch(pattern, name, 0) == 0) { razor_transaction_update_package(trans, package); matches++; @@ -466,7 +476,9 @@ mark_packages_for_removal(struct razor_transaction *trans, int matches = 0; pi = razor_package_iterator_create(set); - while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, NULL)) { + while (razor_package_iterator_next(pi, &package, + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_LAST)) { if (pattern && fnmatch(pattern, name, 0) == 0) { razor_transaction_remove_package(trans, package); matches++; @@ -676,7 +688,8 @@ download_packages(struct razor_set *system, struct razor_set *next) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { snprintf(url, sizeof url, "%s/Packages/%s", yum_url, rpm_filename(name, version, arch)); @@ -708,7 +721,8 @@ install_packages(struct razor_set *system, struct razor_set *next) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { printf("install %s-%s\n", name, version); snprintf(file, sizeof file, @@ -816,7 +830,8 @@ command_download(int argc, const char *argv[]) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { if (pattern && fnmatch(pattern, name, 0) != 0) continue; @@ -859,7 +874,8 @@ command_info(int argc, const char *argv[]) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { if (pattern && fnmatch(pattern, name, 0) != 0) continue; @@ -868,7 +884,7 @@ command_info(int argc, const char *argv[]) RAZOR_DETAIL_DESCRIPTION, &description, RAZOR_DETAIL_URL, &url, RAZOR_DETAIL_LICENSE, &license, - NULL); + RAZOR_DETAIL_LAST); printf ("Name: %s\n", name); printf ("Arch: %s\n", arch); @@ -920,7 +936,7 @@ command_search(int argc, const char *argv[]) RAZOR_DETAIL_DESCRIPTION, &description, RAZOR_DETAIL_URL, &url, RAZOR_DETAIL_LICENSE, &license, - NULL)) { + RAZOR_DETAIL_LAST)) { if (!fnmatch(pattern, name, FNM_CASEFOLD) || !fnmatch(pattern, url, FNM_CASEFOLD) || !fnmatch(pattern, summary, FNM_CASEFOLD) || @@ -313,7 +313,8 @@ add_command_line_packages(struct razor_set *set, pi = razor_package_iterator_create(set); while (razor_package_iterator_next(pi, &package, - RAZOR_DETAIL_NAME, &name, NULL)) { + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_LAST)) { while (cmp = strcmp(argv[i], name), cmp < 0 && i < argc) { fprintf(stderr, "error: package %s is not installed\n", argv[i]); @@ -422,7 +423,7 @@ print_package_info(struct razor_set *set, struct razor_package *package, RAZOR_DETAIL_DESCRIPTION, &description, RAZOR_DETAIL_URL, &url, RAZOR_DETAIL_LICENSE, &license, - NULL); + RAZOR_DETAIL_LAST); printf("Name: %s\n", name); printf("Arch: %s\n", arch); @@ -494,7 +495,8 @@ command_query(int argc, const char *argv[]) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { if (option_conflicts) print_package_properties(set, package, RAZOR_PROPERTY_CONFLICTS); @@ -548,7 +550,8 @@ command_verify(int argc, const char *argv[]) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, NULL)) { + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { printf("verify %s-%s.%s - not implemented\n", name, version, arch); } @@ -593,7 +596,7 @@ command_erase(int argc, const char *argv[]) add_command_line_packages(set, query, argc, argv); pi = razor_package_query_finish(query); - while (razor_package_iterator_next(pi, &package, NULL)) + while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_LAST)) razor_transaction_remove_package(trans, package); razor_package_iterator_destroy(pi); @@ -635,7 +638,7 @@ command_install(int argc, const char *argv[]) trans = razor_transaction_create(set, upstream); pi = razor_package_iterator_create(upstream); - while (razor_package_iterator_next(pi, &package, NULL)) + while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_LAST)) razor_transaction_install_package(trans, package); razor_package_iterator_destroy(pi); @@ -677,7 +680,7 @@ command_update(int argc, const char *argv[]) trans = razor_transaction_create(set, upstream); pi = razor_package_iterator_create(upstream); - while (razor_package_iterator_next(pi, &package, NULL)) + while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_LAST)) razor_transaction_update_package(trans, package); razor_package_iterator_destroy(pi); diff --git a/src/test-driver.c b/src/test-driver.c index bd7aa17..99b4d00 100644 --- a/src/test-driver.c +++ b/src/test-driver.c @@ -293,7 +293,10 @@ get_package(struct razor_set *set, const char *package) const char *name, *version, *arch; pi = razor_package_iterator_create(set); - while (razor_package_iterator_next(pi, &p, &name, &version, &arch)) { + while (razor_package_iterator_next(pi, &p, RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_ARCH, &arch, + RAZOR_DETAIL_LAST)) { if (strcmp(package, name) == 0) break; } |