From: rkinyon Date: Tue, 5 Dec 2006 03:02:23 +0000 (+0000) Subject: Removed deep recursion warning by converting tail-recursive function to an iterative... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=378b474875cfb577042df7a0eaeaba3bc37dbab7;p=dbsrgits%2FDBM-Deep.git Removed deep recursion warning by converting tail-recursive function to an iterative algorithm --- diff --git a/lib/DBM/Deep/Engine3.pm b/lib/DBM/Deep/Engine3.pm index c82c76a..0290620 100644 --- a/lib/DBM/Deep/Engine3.pm +++ b/lib/DBM/Deep/Engine3.pm @@ -712,14 +712,17 @@ sub chain_loc { sub data { my $self = shift; - my $chain_loc = $self->chain_loc; + my $data; + while ( 1 ) { + my $chain_loc = $self->chain_loc; - my $data = $self->engine->storage->read_at( - $self->offset + 2 + $self->engine->byte_size + 1, $self->data_length, - ); + $data .= $self->engine->storage->read_at( + $self->offset + 2 + $self->engine->byte_size + 1, $self->data_length, + ); - if ( $chain_loc ) { - $data .= $self->engine->_load_sector( $chain_loc )->data; + last unless $chain_loc; + + $self = $self->engine->_load_sector( $chain_loc ); } return $data; diff --git a/t/10_largekeys.todo b/t/10_largekeys.t similarity index 100% rename from t/10_largekeys.todo rename to t/10_largekeys.t