Added LTO support and fix warnings (maybe-uninitialized).

This commit is contained in:
Juan RP
2019-06-27 17:09:43 +02:00
parent bb96486b12
commit 0677678387
32 changed files with 92 additions and 76 deletions

View File

@@ -98,7 +98,7 @@ list_pkg_alternatives(xbps_dictionary_t pkgd, const char *group, bool print_key)
printf("%s\n", keyname);
for (unsigned int x = 0; x < xbps_array_count(array); x++) {
const char *str;
const char *str = NULL;
xbps_array_get_cstring_nocopy(array, x, &str);
printf(" - %s\n", str);
@@ -144,7 +144,7 @@ list_alternatives(struct xbps_handle *xhp, const char *pkgname, const char *grp)
printf("%s\n", keyname);
for (unsigned int x = 0; x < xbps_array_count(array); x++) {
const char *str;
const char *str = NULL;
xbps_array_get_cstring_nocopy(array, x, &str);
printf(" - %s%s\n", str, x == 0 ? " (current)" : "");

View File

@@ -286,7 +286,7 @@ static bool
entry_is_conf_file(const char *file)
{
xbps_array_t a;
const char *curfile;
const char *curfile = NULL;
assert(file);

View File

@@ -350,7 +350,7 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f,
i = xbps_array_count(rdeps);
while (i--) {
xbps_dictionary_t rpkgd;
const char *pkgdep;
const char *pkgdep = NULL;
unsigned int pkgidx = 0;
bool found = false;
@@ -382,7 +382,7 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f,
rpkgrdeps = xbps_dictionary_get(rpkgd, "run_depends");
for (x = 0; x < xbps_array_count(rpkgrdeps); x++) {
struct pkgdep *ppd;
const char *rpkgdep;
const char *rpkgdep = NULL;
xbps_array_get_cstring_nocopy(rpkgrdeps, x, &rpkgdep);
SLIST_FOREACH(ppd, &pkgdep_list, pkgdep_entries) {
@@ -406,7 +406,7 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f,
fprintf(f, "\t%u [label=\"%s\",style=\"filled\",fillcolor=\"darksalmon\"];\n", i, pkgver);
rpkgrdeps = xbps_dictionary_get(pkgd, "run_depends");
for (x = 0; x < xbps_array_count(rpkgrdeps); x++) {
const char *rpkgdep;
const char *rpkgdep = NULL;
xbps_array_get_cstring_nocopy(rpkgrdeps, x, &rpkgdep);
SLIST_FOREACH(pd, &pkgdep_list, pkgdep_entries) {

View File

@@ -39,7 +39,7 @@
static void
print_array(xbps_array_t a)
{
const char *str;
const char *str = NULL;
for (unsigned int i = 0; i < xbps_array_count(a); i++) {
xbps_array_get_cstring_nocopy(a, i, &str);

View File

@@ -42,7 +42,7 @@ pkgdb_cb(struct xbps_handle *xhp UNUSED,
void *arg,
bool *done UNUSED)
{
const char *pkgver;
const char *pkgver = NULL;
char *pkgname;
int rv, *errors = (int *)arg;

View File

@@ -52,7 +52,7 @@ check_file_mtime(xbps_dictionary_t d, const char *pkg, const char *path)
{
struct stat sb;
uint64_t mtime = 0;
const char *file;
const char *file = NULL;
/* if obj is not there, skip silently */
if (!xbps_dictionary_get_uint64(d, "mtime", &mtime))
@@ -82,7 +82,7 @@ check_pkg_files(struct xbps_handle *xhp, const char *pkgname, void *arg)
xbps_object_t obj;
xbps_object_iterator_t iter;
xbps_dictionary_t pkg_filesd = arg;
const char *file, *sha256;
const char *file = NULL, *sha256 = NULL;
char *path;
bool mutable, test_broken = false;
int rv = 0, errors = 0;

View File

@@ -49,7 +49,7 @@ check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
{
xbps_dictionary_t pkg_propsd = arg;
xbps_array_t array;
const char *reqpkg;
const char *reqpkg = NULL;
int rv = 0;
if (!xbps_pkg_has_rundeps(pkg_propsd))

View File

@@ -45,7 +45,7 @@ list_pkgs_in_dict(struct xbps_handle *xhp UNUSED,
bool *loop_done UNUSED)
{
struct list_pkgver_cb *lpc = arg;
const char *pkgver, *short_desc, *state_str;
const char *pkgver = NULL, *short_desc = NULL, *state_str = NULL;
char tmp[255], *out = NULL;
int i, len = 0;
pkg_state_t state;
@@ -94,7 +94,7 @@ list_manual_pkgs(struct xbps_handle *xhp UNUSED,
void *arg UNUSED,
bool *loop_done UNUSED)
{
const char *pkgver;
const char *pkgver = NULL;
bool automatic = false;
xbps_dictionary_get_bool(obj, "automatic-install", &automatic);
@@ -113,7 +113,7 @@ list_hold_pkgs(struct xbps_handle *xhp UNUSED,
void *arg UNUSED,
bool *loop_done UNUSED)
{
const char *pkgver;
const char *pkgver = NULL;
if (xbps_dictionary_get(obj, "hold")) {
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
@@ -130,7 +130,7 @@ list_repolock_pkgs(struct xbps_handle *xhp UNUSED,
void *arg UNUSED,
bool *loop_done UNUSED)
{
const char *pkgver;
const char *pkgver = NULL;
if (xbps_dictionary_get(obj, "repolock")) {
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
@@ -144,7 +144,7 @@ int
list_orphans(struct xbps_handle *xhp)
{
xbps_array_t orphans;
const char *pkgver;
const char *pkgver = NULL;
orphans = xbps_find_pkg_orphans(xhp, NULL);
if (orphans == NULL)
@@ -226,7 +226,7 @@ _find_longest_pkgver_cb(struct xbps_handle *xhp UNUSED,
bool *loop_done UNUSED)
{
struct fflongest *ffl = arg;
const char *pkgver;
const char *pkgver = NULL;
unsigned int len;
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);

View File

@@ -51,7 +51,7 @@ match_files_by_pattern(xbps_dictionary_t pkg_filesd,
const char *pkgver)
{
xbps_array_t array;
const char *keyname, *typestr;
const char *keyname = NULL, *typestr = NULL;
keyname = xbps_dictionary_keysym_cstring_nocopy(key);
@@ -104,7 +104,7 @@ ownedby_pkgdb_cb(struct xbps_handle *xhp,
xbps_dictionary_t pkgmetad;
xbps_array_t files_keys;
struct ffdata *ffd = arg;
const char *pkgver;
const char *pkgver = NULL;
(void)obj_key;
(void)done;
@@ -136,7 +136,7 @@ repo_match_cb(struct xbps_handle *xhp,
xbps_dictionary_t filesd;
xbps_array_t files_keys;
struct ffdata *ffd = arg;
const char *pkgver;
const char *pkgver = NULL;
char *bfile;
xbps_dictionary_set_cstring_nocopy(obj, "repository", ffd->repouri);

View File

@@ -54,7 +54,7 @@ struct search_data {
static void
print_results(struct xbps_handle *xhp, struct search_data *sd)
{
const char *pkgver, *desc, *inststr;
const char *pkgver = NULL, *desc = NULL, *inststr = NULL;
char tmp[256], *out;
unsigned int j, tlen = 0, len = 0;
@@ -102,7 +102,7 @@ search_array_cb(struct xbps_handle *xhp UNUSED,
{
xbps_object_t obj2;
struct search_data *sd = arg;
const char *pkgver = NULL, *desc, *str;
const char *pkgver = NULL, *desc = NULL, *str = NULL;
if (!xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver))
return 0;

View File

@@ -59,7 +59,7 @@ show_pkg_deps(struct xbps_handle *xhp, const char *pkgname, bool repomode, bool
rdeps = xbps_dictionary_get(pkgd, "run_depends");
}
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
const char *pkgdep;
const char *pkgdep = NULL;
xbps_array_get_cstring_nocopy(rdeps, i, &pkgdep);
printf("%s\n", pkgdep);
}
@@ -70,7 +70,7 @@ int
show_pkg_revdeps(struct xbps_handle *xhp, const char *pkg, bool repomode)
{
xbps_array_t revdeps;
const char *pkgdep;
const char *pkgdep = NULL;
if (repomode)
revdeps = xbps_rpool_get_pkg_revdeps(xhp, pkg);

View File

@@ -209,7 +209,7 @@ show_pkg_files(xbps_dictionary_t filesd)
xbps_array_t array, allkeys;
xbps_object_t obj;
xbps_dictionary_keysym_t ksym;
const char *keyname, *file;
const char *keyname = NULL, *file = NULL;
if (xbps_object_type(filesd) != XBPS_TYPE_DICTIONARY)
return EINVAL;

View File

@@ -135,7 +135,7 @@ repodata_commit(struct xbps_handle *xhp, const char *repodir,
pkgshlibs = xbps_dictionary_get(pkg, "shlib-provides");
for (unsigned int i = 0; i < xbps_array_count(pkgshlibs); i++) {
const char *shlib;
const char *shlib = NULL;
xbps_array_get_cstring_nocopy(pkgshlibs, i, &shlib);
xbps_dictionary_remove(usedshlibs, shlib);
}
@@ -152,7 +152,7 @@ repodata_commit(struct xbps_handle *xhp, const char *repodir,
pkgshlibs = xbps_dictionary_get(pkg, "shlib-provides");
for (unsigned int i = 0; i < xbps_array_count(pkgshlibs); i++) {
const char *shlib;
const char *shlib = NULL;
xbps_array_get_cstring_nocopy(pkgshlibs, i, &shlib);
xbps_dictionary_remove(usedshlibs, shlib);
}
@@ -171,7 +171,7 @@ repodata_commit(struct xbps_handle *xhp, const char *repodir,
printf(" %s (provided by: %s; used by: ", shlib, provider);
pre = "";
for (unsigned int i = 0; i < xbps_array_count(users); i++) {
const char *user;
const char *user = NULL;
xbps_array_get_cstring_nocopy(users, i, &user);
xbps_dictionary_remove(usedshlibs, shlib);
printf("%s%s",pre, user);
@@ -183,7 +183,7 @@ repodata_commit(struct xbps_handle *xhp, const char *repodir,
iter = xbps_dictionary_iterator(stage);
while ((keysym = xbps_object_iterator_next(iter))) {
xbps_dictionary_t pkg = xbps_dictionary_get_keysym(stage, keysym);
const char *pkgver, *arch;
const char *pkgver = NULL, *arch = NULL;
xbps_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver);
xbps_dictionary_get_cstring_nocopy(pkg, "architecture", &arch);
printf("stage: added `%s' (%s)\n", pkgver, arch);
@@ -197,7 +197,7 @@ repodata_commit(struct xbps_handle *xhp, const char *repodir,
while ((keysym = xbps_object_iterator_next(iter))) {
const char *pkgname = xbps_dictionary_keysym_cstring_nocopy(keysym);
xbps_dictionary_t pkg = xbps_dictionary_get_keysym(stage, keysym);
const char *pkgver, *arch;
const char *pkgver = NULL, *arch = NULL;
xbps_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver);
xbps_dictionary_get_cstring_nocopy(pkg, "architecture", &arch);
printf("index: added `%s' (%s).\n", pkgver, arch);

View File

@@ -53,7 +53,7 @@ idx_cleaner_cb(struct xbps_handle *xhp,
bool *done UNUSED)
{
struct CleanerCbInfo *info = arg;
const char *arch, *pkgver, *sha256;
const char *arch = NULL, *pkgver = NULL, *sha256 = NULL;
char *filen, *pkgname;
xbps_dictionary_get_cstring_nocopy(obj, "architecture", &arch);