From f9930ec4fc0760581b93d4dcd44bb9e76924b884 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 5 Feb 2020 15:52:06 +0100 Subject: [PATCH] src/main.cpp: refactor the do/while loop for search flags into just a while loop. --- src/main.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 572183e..3efd467 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -147,19 +147,11 @@ int main(int argc, char **argv) { } if (!strcmp(argv[p], "search")) { - bool parse_opt; - p++; - do { - parse_opt = false; - - if (p < argc && !strcmp(argv[p], "--l33t")) { + while(p++ < argc) { + if (!strcmp(argv[p], "--l33t")) { option_l33t = true; - parse_opt = true; - p++; - } - - if (p < argc && !memcmp(argv[p], "--threads=", 10)) { + } else if (!memcmp(argv[p], "--threads=", 10)) { #ifdef HAVE_THREADS option_num_threads = atoi(argv[p] + 10); if (option_num_threads < 2) { @@ -173,10 +165,12 @@ int main(int argc, char **argv) { std::cerr << "NOTICE: eosio-keygen is not compiled with" << " thread support. this option is ignored." << std::endl; #endif /* HAVE_THREADS */ - p++; - parse_opt = true; } - } while(parse_opt && p < argc); + // Nothing to parse + else { + break; + } + } if (argc <= p) { std::cerr << "You must specify a word list." << std::endl;