mirror of https://github.com/status-im/evmc.git
Merge pull request #28 from ethereum/vmtester-symbol-search
vmtester: Simplify create function search
This commit is contained in:
commit
9a76210af7
|
@ -22,14 +22,6 @@ namespace
|
|||
{
|
||||
boost::function<evmc_create_fn> create_fn;
|
||||
|
||||
bool starts_with(const std::string& str, const std::string& prefix)
|
||||
{
|
||||
if (str.size() < prefix.size())
|
||||
return false;
|
||||
|
||||
return std::equal(prefix.begin(), prefix.end(), str.begin());
|
||||
}
|
||||
|
||||
std::unique_ptr<evmc_instance, evmc_destroy_fn> create_vm()
|
||||
{
|
||||
auto vm = create_fn();
|
||||
|
@ -75,7 +67,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
auto symbols = dll::library_info{vm_path}.symbols();
|
||||
auto it = std::find_if(symbols.begin(), symbols.end(),
|
||||
[](const std::string& symbol) { return starts_with(symbol, "evmc_create_"); });
|
||||
[](const std::string& symbol) { return symbol.find("evmc_create_") == 0; });
|
||||
if (it == symbols.end())
|
||||
{
|
||||
std::cerr << "EVMC create function not found in " << vm_path.string() << "\n";
|
||||
|
|
Loading…
Reference in New Issue