mirror of https://github.com/status-im/evmc.git
Do not shadow variable names
This commit is contained in:
parent
6474579357
commit
ff14830784
|
@ -28,7 +28,7 @@ static evmc_result execute_identity(const evmc_message* msg)
|
||||||
result.status_code = EVMC_SUCCESS;
|
result.status_code = EVMC_SUCCESS;
|
||||||
result.output_data = data;
|
result.output_data = data;
|
||||||
result.output_size = msg->input_size;
|
result.output_size = msg->input_size;
|
||||||
result.release = [](const evmc_result* result) { delete[] result->output_data; };
|
result.release = [](const evmc_result* r) { delete[] r->output_data; };
|
||||||
result.gas_left = gas_left;
|
result.gas_left = gas_left;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ class HostContext : public HostInterface
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Implicit converting constructor from evmc_context.
|
/// Implicit converting constructor from evmc_context.
|
||||||
HostContext(evmc_context* context) noexcept : context{context} {} // NOLINT
|
HostContext(evmc_context* ctx) noexcept : context{ctx} {} // NOLINT
|
||||||
|
|
||||||
bool account_exists(const evmc_address& address) noexcept final
|
bool account_exists(const evmc_address& address) noexcept final
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,18 +31,20 @@ evmc_instance* get_vm_instance()
|
||||||
class cli_parser
|
class cli_parser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char* const app_name = nullptr;
|
const char* const application_name = nullptr;
|
||||||
const char* const app_version = nullptr;
|
const char* const application_version = nullptr;
|
||||||
|
|
||||||
std::vector<std::string> args_names;
|
std::vector<std::string> arguments_names;
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> arguments;
|
||||||
|
|
||||||
cli_parser(const char* app_name,
|
cli_parser(const char* app_name,
|
||||||
const char* app_version,
|
const char* app_version,
|
||||||
std::vector<std::string> args_names) noexcept
|
std::vector<std::string> args_names) noexcept
|
||||||
: app_name{app_name}, app_version{app_version}, args_names{std::move(args_names)}
|
: application_name{app_name},
|
||||||
|
application_version{app_version},
|
||||||
|
arguments_names{std::move(args_names)}
|
||||||
{
|
{
|
||||||
args.reserve(this->args_names.size());
|
arguments.reserve(this->arguments_names.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses the command line arguments.
|
/// Parses the command line arguments.
|
||||||
|
@ -67,12 +69,12 @@ public:
|
||||||
if (x == 0) // Argument.
|
if (x == 0) // Argument.
|
||||||
{
|
{
|
||||||
++num_args;
|
++num_args;
|
||||||
if (num_args > args_names.size())
|
if (num_args > arguments_names.size())
|
||||||
{
|
{
|
||||||
err << "Unexpected argument \"" << arg << "\"\n";
|
err << "Unexpected argument \"" << arg << "\"\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
args.emplace_back(std::move(arg));
|
arguments.emplace_back(std::move(arg));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (x <= 2)
|
else if (x <= 2)
|
||||||
|
@ -95,12 +97,12 @@ public:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << app_name << " " << app_version << "\n";
|
out << application_name << " " << application_version << "\n";
|
||||||
|
|
||||||
if (help)
|
if (help)
|
||||||
{
|
{
|
||||||
out << "Usage: " << argv[0];
|
out << "Usage: " << argv[0];
|
||||||
for (const auto& name : args_names)
|
for (const auto& name : arguments_names)
|
||||||
out << " " << name;
|
out << " " << name;
|
||||||
out << "\n";
|
out << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -109,10 +111,10 @@ public:
|
||||||
if (version)
|
if (version)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (num_args < args_names.size())
|
if (num_args < arguments_names.size())
|
||||||
{
|
{
|
||||||
for (auto i = num_args; i < args_names.size(); ++i)
|
for (auto i = num_args; i < arguments_names.size(); ++i)
|
||||||
err << "The " << args_names[i] << " argument is required.\n";
|
err << "The " << arguments_names[i] << " argument is required.\n";
|
||||||
err << "Run with --help for more information.\n";
|
err << "Run with --help for more information.\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +135,7 @@ int main(int argc, char* argv[])
|
||||||
if (error_code <= 0)
|
if (error_code <= 0)
|
||||||
return error_code;
|
return error_code;
|
||||||
|
|
||||||
const auto& evmc_module = cli.args[0];
|
const auto& evmc_module = cli.arguments[0];
|
||||||
std::cout << "Testing " << evmc_module << "\n";
|
std::cout << "Testing " << evmc_module << "\n";
|
||||||
evmc_loader_error_code ec;
|
evmc_loader_error_code ec;
|
||||||
create_fn = evmc_load(evmc_module.c_str(), &ec);
|
create_fn = evmc_load(evmc_module.c_str(), &ec);
|
||||||
|
|
Loading…
Reference in New Issue