Merge pull request #28 from ethereum/vmtester-symbol-search

vmtester: Simplify create function search
This commit is contained in:
Alex Beregszaszi 2018-04-23 13:11:41 +01:00 committed by GitHub
commit 9a76210af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -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";