diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-07-12 01:01:17 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-12 20:38:02 +0200 |
commit | b76014b8ef3862b4168148cb20e1108d9c0df5f6 (patch) | |
tree | 53fc4e4c0fdf6dd6d4c1f58c72ff8c60c9cbfd40 /src | |
parent | 5b87b6eda3a3958ccb33aa411f48bdee496717a9 (diff) |
statemachine: Move invariant code out of loop body
The lca variable doesn't change inside the loop. Comparing our
implementation to the algorithm in the SCXML spec reveals that this
check should indeed be done outside the loop.
Change-Id: I5e9824758fd147766e975d107a73561bd7f5a190
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/statemachine/qstatemachine.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index a83737d344..ccc40ac9b4 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -517,12 +517,12 @@ QList<QAbstractState*> QStateMachinePrivate::computeStatesToEnter(const QList<QA for (int j = src ? 1 : 0; j < lst.size(); ++j) { QAbstractState *s = lst.at(j); addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry); - if (isParallel(lca)) { - QList<QAbstractState*> lcac = QStatePrivate::get(lca)->childStates(); - foreach (QAbstractState* child,lcac) { - if (!statesToEnter.contains(child)) - addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); - } + } + if (isParallel(lca)) { + QList<QAbstractState*> lcac = QStatePrivate::get(lca)->childStates(); + foreach (QAbstractState* child,lcac) { + if (!statesToEnter.contains(child)) + addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); } } } |