vmtester: Simplify create function search

This commit is contained in:
Paweł Bylica 2018-04-23 14:07:59 +02:00
parent 27e51a9a35
commit f07e7ebbe5
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
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";