xbps-dgraph/main.c: simplify logic.

Thanks to clang-analyzer for reporting a dead assignment
that lead me to rework the logic.
This commit is contained in:
Juan RP 2019-06-18 14:38:49 +02:00
parent 5f68687cbb
commit 042ab422b2

View File

@ -532,10 +532,10 @@ main(int argc, char **argv)
FILE *f = NULL; FILE *f = NULL;
const char *pkg, *confdir, *conf_file, *rootdir; const char *pkg, *confdir, *conf_file, *rootdir;
int c, rv, flags = 0; int c, rv, flags = 0;
bool opmode, repomode, fulldepgraph, metadata; bool opmode, repomode, fulldepgraph;
pkg = confdir = conf_file = rootdir = NULL; pkg = confdir = conf_file = rootdir = NULL;
opmode = repomode = fulldepgraph = metadata = false; opmode = repomode = fulldepgraph = false;
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
switch (c) { switch (c) {
@ -562,11 +562,12 @@ main(int argc, char **argv)
flags |= XBPS_FLAG_REPOS_MEMSYNC; flags |= XBPS_FLAG_REPOS_MEMSYNC;
break; break;
case 'm': case 'm':
opmode = metadata = true; /* pkgdb metadata mode */
opmode = true;
break; break;
case 'R': case 'R':
/* enable repository mode */ /* enable repository mode */
repomode = true; opmode = repomode = true;
break; break;
case 'r': case 'r':
/* Set different rootdir. */ /* Set different rootdir. */
@ -586,9 +587,6 @@ main(int argc, char **argv)
if (!argc && !opmode) { if (!argc && !opmode) {
usage(); usage();
} else if (!opmode) {
/* metadata mode by default */
metadata = opmode = true;
} }
pkg = *argv; pkg = *argv;