Skip to content

Commit

Permalink
refactor: use c++11 range based for loop in checkObject
Browse files Browse the repository at this point in the history
  • Loading branch information
fanquake authored and Martin Leitner-Ankerl committed May 9, 2022
1 parent ae65f12 commit f75cc75
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/univalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,19 @@ bool UniValue::findKey(const std::string& key, size_t& retIdx) const

bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t) const
{
if (typ != VOBJ)
if (typ != VOBJ) {
return false;
}

for (std::map<std::string,UniValue::VType>::const_iterator it = t.begin();
it != t.end(); ++it) {
for (const auto& object: t) {
size_t idx = 0;
if (!findKey(it->first, idx))
if (!findKey(object.first, idx)) {
return false;
}

if (values.at(idx).getType() != it->second)
if (values.at(idx).getType() != object.second) {
return false;
}
}

return true;
Expand Down

0 comments on commit f75cc75

Please sign in to comment.