From 097b50b3c2dbf2ea30dcfd80265023ec44c79f40 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 3 Feb 2011 17:49:43 +0100 Subject: [PATCH] Fix all warnings found by clang analyzer as reported by ojab in issue 3. --- bin/xbps-bin/check.c | 1 - bin/xbps-bin/main.c | 2 +- bin/xbps-dgraph/main.c | 1 - lib/package_unpack.c | 2 +- lib/repository_finddeps.c | 4 ++-- lib/repository_findpkg.c | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/xbps-bin/check.c b/bin/xbps-bin/check.c index 3e926745..0a38abd1 100644 --- a/bin/xbps-bin/check.c +++ b/bin/xbps-bin/check.c @@ -254,7 +254,6 @@ xbps_check_pkg_integrity(const char *pkgname) } rv = xbps_check_is_installed_pkg_by_pattern(reqpkg); if (rv <= 0) { - rv = ENOENT; printf("%s: dependency not satisfied: %s\n", pkgname, reqpkg); } diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index 41533d31..5631ac96 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -158,7 +158,7 @@ main(int argc, char **argv) bool yes, purge, with_debug, force_rm_with_deps, recursive_rm; bool show_download_pkglist_url = false; - i = c = flags = rv = 0; + flags = rv = 0; yes = purge = force_rm_with_deps = recursive_rm = with_debug = false; while ((c = getopt(argc, argv, "VcdDFfpRr:vy")) != -1) { diff --git a/bin/xbps-dgraph/main.c b/bin/xbps-dgraph/main.c index 422778d0..9078e74a 100644 --- a/bin/xbps-dgraph/main.c +++ b/bin/xbps-dgraph/main.c @@ -258,7 +258,6 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd, keyobj = prop_dictionary_get_keysym(plistd, dksym); keyname = strip_dashes_from_key(tmpkeyname); - optnodetmp = ""; optnode = NULL; fprintf(f, " main -> %s [label=\"%s\"];\n", diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 7c178822..405da9dc 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -163,7 +163,7 @@ unpack_archive(prop_dictionary_t pkg_repod, void (*progress_cb)(void *), struct xbps_unpack_progress_data *xupd) { - prop_dictionary_t propsd, filesd, old_filesd; + prop_dictionary_t propsd = NULL, filesd = NULL, old_filesd = NULL; prop_array_t array; struct archive_entry *entry; size_t nmetadata = 0, entry_idx = 0; diff --git a/lib/repository_finddeps.c b/lib/repository_finddeps.c index 6a8bc1b9..e58c4c44 100644 --- a/lib/repository_finddeps.c +++ b/lib/repository_finddeps.c @@ -76,7 +76,7 @@ store_dependency(prop_dictionary_t transd, prop_dictionary_t repo_pkgd) * Overwrite package state in dictionary if it was unpacked * previously. */ - if ((rv = xbps_get_pkg_state_installed(pkgname, &state)) == 0) { + if (xbps_get_pkg_state_installed(pkgname, &state) == 0) { if ((rv = xbps_set_pkg_state_dictionary(dict, state)) != 0) { prop_object_release(dict); return rv; @@ -216,7 +216,7 @@ find_repo_deps(prop_dictionary_t transd, /* transaction dictionary */ * current package. */ while ((obj = prop_object_iterator_next(iter)) != NULL) { - tmpd = curpkgd = NULL; + curpkgd = NULL; reqpkg = prop_string_cstring_nocopy(obj); if (reqpkg == NULL) { rv = EINVAL; diff --git a/lib/repository_findpkg.c b/lib/repository_findpkg.c index 81884d9c..bb25e15d 100644 --- a/lib/repository_findpkg.c +++ b/lib/repository_findpkg.c @@ -93,7 +93,7 @@ repository_find_pkg(const char *pattern, const char *reason) assert(pattern != NULL); assert(reason != NULL); - success = install = bypattern = bestpkg = false; + install = bypattern = false; if (strcmp(reason, "install") == 0) { /* install */