diff options
author | Håvard Pettersen <havardpe@oath.com> | 2022-03-31 11:44:10 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2022-04-01 10:24:32 +0000 |
commit | d71f76a73fe54558f613e75a3a8cfd70fc46a7e8 (patch) | |
tree | 7d170e5b792dbf5fed06ff7c7b2db398b6cb64c7 /searchlib/src/tests/bitvector | |
parent | 1bb3dd192f4bcb91e710fe19ca54b2b8935ffb83 (diff) |
use getopt/getopt_long directly
Diffstat (limited to 'searchlib/src/tests/bitvector')
-rw-r--r-- | searchlib/src/tests/bitvector/bitvectorbenchmark.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp index 52888d0c659..e140814a5ad 100644 --- a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp +++ b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp @@ -6,6 +6,7 @@ #include <string> #include <vector> #include <cassert> +#include <unistd.h> LOG_SETUP("bitvectorbenchmark"); @@ -165,19 +166,17 @@ void BitVectorBenchmark::testOrSpeed2() int BitVectorBenchmark::Main() { - int idx = 1; std::string operation; size_t numBits(8*1000000); int opt; - const char * arg; bool optError = false; - while ((opt = GetOpt("n:t:", arg, idx)) != -1) { + while ((opt = getopt(_argc, _argv, "n:t:")) != -1) { switch (opt) { case 'n': - numBits = strtoll(arg, NULL, 10); + numBits = strtoll(optarg, NULL, 10); break; case 't': - operation = arg; + operation = optarg; break; default: optError = true; @@ -185,7 +184,7 @@ int BitVectorBenchmark::Main() } } - if ((_argc != idx ) || optError) { + if ((_argc != optind ) || optError) { usage(); return -1; } |