mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-03 16:30:42 +02:00
bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...)
This commit is contained in:
parent
e24bf1ce18
commit
f41d339b78
@ -6,11 +6,10 @@
|
|||||||
|
|
||||||
#include <crypto/sha256.h>
|
#include <crypto/sha256.h>
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
#include <validation.h>
|
|
||||||
#include <util.h>
|
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
|
#include <util.h>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <utilstrencodings.h>
|
||||||
|
#include <validation.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -64,8 +63,11 @@ int main(int argc, char** argv)
|
|||||||
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
|
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
|
||||||
bool is_list_only = gArgs.GetBoolArg("-list", false);
|
bool is_list_only = gArgs.GetBoolArg("-list", false);
|
||||||
|
|
||||||
double scaling_factor = boost::lexical_cast<double>(scaling_str);
|
double scaling_factor;
|
||||||
|
if (!ParseDouble(scaling_str, &scaling_factor)) {
|
||||||
|
fprintf(stderr, "Error parsing scaling factor as double: %s\n", scaling_str.c_str());
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<benchmark::Printer> printer(new benchmark::ConsolePrinter());
|
std::unique_ptr<benchmark::Printer> printer(new benchmark::ConsolePrinter());
|
||||||
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER);
|
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user