/** This method returns to the last snapshot before the inputted
* sequence number. This function must be called from the model
* checking thread and not from a snapshotted stack.
/** This method returns to the last snapshot before the inputted
* sequence number. This function must be called from the model
* checking thread and not from a snapshotted stack.
- while (true) {
- if (stack->index <= seqindex) {
- //have right entry
- snapshot_roll_back(stack->snapshotid);
- return stack->index;
- }
- struct stackEntry *tmp = stack;
- stack = stack->next;
- model_free(tmp);
- }
+ int i;
+ for (i = (int)stack.size() - 1; i >= 0; i++)
+ if (stack[i].index <= seqindex)
+ break;
+ else
+ stack.pop_back();
+
+ ASSERT(i >= 0);
+ snapshot_roll_back(stack[i].snapshotid);
+ return stack[i].index;
}
/** This method takes a snapshot at the given sequence number. */
void SnapshotStack::snapshotStep(int seqindex)
{
}
/** This method takes a snapshot at the given sequence number. */
void SnapshotStack::snapshotStep(int seqindex)
{