avoid recursion on very deep sequences of static indices.

This commit is contained in:
Vítor Santos Costa 2010-10-07 18:14:55 +01:00
parent f56cf4a737
commit 61d99731c8

View File

@ -635,19 +635,23 @@ CleanLUIndex(LogUpdIndex *idx, int recurse)
static void
CleanSIndex(StaticIndex *idx, int recurse)
{
idx->ClPred = PtoPredAdjust(idx->ClPred);
if (idx->SiblingIndex) {
idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex);
if (recurse)
CleanSIndex(idx->SiblingIndex, TRUE);
beginning:
if (!(idx->ClFlags & SwitchTableMask)) {
restore_opcodes(idx->ClCode, NULL);
}
idx->ClPred = PtoPredAdjust(idx->ClPred);
if (idx->ChildIndex) {
idx->ChildIndex = SIndexAdjust(idx->ChildIndex);
if (recurse)
CleanSIndex(idx->ChildIndex, TRUE);
}
if (!(idx->ClFlags & SwitchTableMask)) {
restore_opcodes(idx->ClCode, NULL);
if (idx->SiblingIndex) {
idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex);
/* use loop to avoid recursion with very complex indices */
if (recurse) {
idx = idx->SiblingIndex;
goto beginning;
}
}
}