mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
test: Replace ARRAYLEN with C++11 ranged for loop
This commit is contained in:
@@ -106,18 +106,18 @@ static ScriptErrorDesc script_errors[]={
|
|||||||
|
|
||||||
static std::string FormatScriptError(ScriptError_t err)
|
static std::string FormatScriptError(ScriptError_t err)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i)
|
for (const auto& se : script_errors)
|
||||||
if (script_errors[i].err == err)
|
if (se.err == err)
|
||||||
return script_errors[i].name;
|
return se.name;
|
||||||
BOOST_ERROR("Unknown scripterror enumeration value, update script_errors in script_tests.cpp.");
|
BOOST_ERROR("Unknown scripterror enumeration value, update script_errors in script_tests.cpp.");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static ScriptError_t ParseScriptError(const std::string &name)
|
static ScriptError_t ParseScriptError(const std::string& name)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i)
|
for (const auto& se : script_errors)
|
||||||
if (script_errors[i].name == name)
|
if (se.name == name)
|
||||||
return script_errors[i].err;
|
return se.err;
|
||||||
BOOST_ERROR("Unknown scripterror \"" << name << "\" in test description");
|
BOOST_ERROR("Unknown scripterror \"" << name << "\" in test description");
|
||||||
return SCRIPT_ERR_UNKNOWN_ERROR;
|
return SCRIPT_ERR_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user