From 530e79c7eefa96dbdeec92498b1b705e67ffc674 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 23 Apr 2020 08:32:54 +0200 Subject: [PATCH] Fix warnings detected by LTO. --- bin/xbps-dgraph/main.c | 2 +- bin/xbps-fbulk/main.c | 6 ++++-- lib/package_alternatives.c | 2 +- lib/package_orphans.c | 2 +- lib/transaction_check_revdeps.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/xbps-dgraph/main.c b/bin/xbps-dgraph/main.c index d8a6d548..ceb0723d 100644 --- a/bin/xbps-dgraph/main.c +++ b/bin/xbps-dgraph/main.c @@ -428,7 +428,7 @@ create_dot_graph(struct xbps_handle *xhp, { xbps_dictionary_t sub_confd; xbps_array_t allkeys, rdeps; - const char *pkgver, *cfprop; + const char *pkgver = NULL, *cfprop; xbps_dictionary_get_cstring_nocopy(plistd, "pkgver", &pkgver); diff --git a/bin/xbps-fbulk/main.c b/bin/xbps-fbulk/main.c index d1585d26..0162915c 100644 --- a/bin/xbps-fbulk/main.c +++ b/bin/xbps-fbulk/main.c @@ -539,14 +539,16 @@ pkgdb_get_pkgs_cb(struct xbps_handle *xhp UNUSED, void *arg, bool *done UNUSED) { xbps_array_t *array = arg; - const char *pkgname; + const char *pkgname = NULL; bool automatic = false; xbps_dictionary_get_bool(obj, "automatic-install", &automatic); if (automatic) return 0; - xbps_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); + if (!xbps_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname)) + return EINVAL; + xbps_array_add_cstring_nocopy(*array, pkgname); return 0; } diff --git a/lib/package_alternatives.c b/lib/package_alternatives.c index 38edb2bf..f23b440d 100644 --- a/lib/package_alternatives.c +++ b/lib/package_alternatives.c @@ -494,7 +494,7 @@ remove_obsoletes(struct xbps_handle *xhp, const char *pkgname, const char *pkgve for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) { xbps_array_t array, array2, array_repo; xbps_object_t keysym; - const char *keyname, *first; + const char *keyname, *first = NULL; keysym = xbps_array_get(allkeys, i); array = xbps_dictionary_get_keysym(pkgd_alts, keysym); diff --git a/lib/package_orphans.c b/lib/package_orphans.c index f7e2d941..a8f5502d 100644 --- a/lib/package_orphans.c +++ b/lib/package_orphans.c @@ -114,7 +114,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user) } /* verify all revdeps are seen */ for (unsigned int i = 0; i < revdepscnt; i++) { - const char *revdepver; + const char *revdepver = NULL; xbps_array_get_cstring_nocopy(revdeps, i, &revdepver); if (xbps_find_pkg_in_array(array, revdepver, 0)) diff --git a/lib/transaction_check_revdeps.c b/lib/transaction_check_revdeps.c index 389daab2..3af3d86d 100644 --- a/lib/transaction_check_revdeps.c +++ b/lib/transaction_check_revdeps.c @@ -215,7 +215,7 @@ xbps_transaction_check_revdeps(struct xbps_handle *xhp, xbps_array_t pkgs) } for (unsigned int j = 0; j < xbps_array_count(rundeps); j++) { - const char *curdep; + const char *curdep = NULL; xbps_array_get_cstring_nocopy(rundeps, j, &curdep); if ((!xbps_pkgpattern_name(curdepname, sizeof(curdepname), curdep)) &&