Skip to content

Commit

Permalink
Another state transition logic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lsileoni committed May 11, 2024
1 parent 078eeb6 commit 381be5e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/config/TiniValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,10 @@ int TiniValidator::validateValue(std::string act, int row)
tiniutils::printErr(TiniNode::E_UNEXP, it - act.begin() + 1, row, act);
return (-1);
}
int good = 0;
for (auto a : _value_transitions[_cur_state])
{
if (a == _next_state)
good = 1;
}
if (good != 1)
if (!std::any_of(
_value_transitions[_cur_state].begin(), _value_transitions[_cur_state].end(),
[&](int correct_transition) { return correct_transition == _next_state; }
))
{
tiniutils::printErr(TiniNode::E_UNEXP, it - act.begin() + 1, row, act);
return (-1);
Expand Down

0 comments on commit 381be5e

Please sign in to comment.