Following a suggestion of Dan Scott's, add a pair of
suspenders to the belt and enforce an arbitrary limit
of 1000 passes through QP->decompse().
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
my $remainder = '';
+ my $loops = 0;
while (!$remainder) {
- warn ' 'x$recursing."Start of the loop. last_type: $last_type, joiner: ".$struct->joiner.", struct: $struct\n" if $self->debug;
+ $loops++;
+ warn ' 'x$recursing."Start of the loop. loop: $loops last_type: $last_type, joiner: ".$struct->joiner.", struct: $struct\n" if $self->debug;
+ if ($loops > 1000) { # the most magical of numbers...
+ warn ' 'x$recursing." got to $loops loops; aborting\n" if $self->debug;
+ last;
+ }
if ($last_type eq 'FEND' and $fstart and $fstart != $struct) { # fall back further
$remainder = $_;
last;