From: rkinyon Date: Wed, 8 Mar 2006 15:31:26 +0000 (+0000) Subject: All create_tag() calls now use _request_space() X-Git-Tag: 0-99_01~68 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2603d86e504595571c122c6f7e77b25c1cf4f219;p=dbsrgits%2FDBM-Deep.git All create_tag() calls now use _request_space() --- diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index ea065ba..0eedb0f 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -622,7 +622,10 @@ sub CLEAR { return; } - $self->{engine}->create_tag($self, $self->_base_offset, $self->_type, chr(0) x $self->{engine}{index_size}); + $self->{engine}->create_tag( + $self, $self->_base_offset, $self->_type, + chr(0) x $self->{engine}{index_size}, + ); $self->unlock(); diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 6816165..c180be9 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -234,10 +234,6 @@ sub create_tag { seek($fh, $offset + $obj->_root->{file_offset}, SEEK_SET); print( $fh $sig . pack($self->{data_pack}, $size) . $content ); - if ($offset == $obj->_root->{end}) { - $obj->_root->{end} += $self->tag_size( $size ); - } - return { signature => $sig, size => $size, @@ -553,9 +549,17 @@ sub split_index { else { $offsets[$num] = $root->{end}; seek($fh, $index_tag->{offset} + ($num * $self->{long_size}) + $root->{file_offset}, SEEK_SET); - print( $fh pack($self->{long_pack}, $root->{end}) ); - my $blist_tag = $self->create_tag($obj, $root->{end}, SIG_BLIST, chr(0) x $self->{bucket_list_size}); + my $loc = $self->_request_space( + $obj, $self->tag_size( $self->{bucket_list_size} ), + ); + + print( $fh pack($self->{long_pack}, $loc) ); + + my $blist_tag = $self->create_tag( + $obj, $loc, SIG_BLIST, + chr(0) x $self->{bucket_list_size}, + ); seek($fh, $blist_tag->{offset} + $root->{file_offset}, SEEK_SET); print( $fh $key . pack($self->{long_pack}, $old_subloc || $root->{end}) );