You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Joe Schaefer <jo...@sunstarsys.com> on 2005/05/13 05:47:56 UTC
Fix table copy & overlay tests
I don't think we're supposed to be mixing
table entries when there's no relation between
the two table's pools. Here's a patch which
fixes the tests; without it the tests segfault
with apr's trunk compiled with --enable-pool-debug.
Index: t/lib/TestAPRlib/table.pm
===================================================================
--- t/lib/TestAPRlib/table.pm (revision 169918)
+++ t/lib/TestAPRlib/table.pm (working copy)
@@ -307,11 +307,12 @@
# - copy
# - overlay
{
- my $table = APR::Table::make(APR::Pool->new, 10);
+ my $pool = APR::Pool->new;
+ my $table = APR::Table::make($pool, 10);
$table->set($_ => $_) for 1..20;
ok t_cmp $table->get(20), 20, "no segfault";
-
- my $table_copy = $table->copy(APR::Pool->new);
+ my $sub_pool = $pool->new;
+ my $table_copy = $table->copy($sub_pool);
{
# verify that the temp pool used to create $table_copy was
# not freed, by allocating a new table to fill with a
@@ -325,9 +326,9 @@
}
ok t_cmp $table_copy->get(20), 20, "no segfault/valid data";
- my $table2 = APR::Table::make(APR::Pool->new, 1);
+ my $table2 = APR::Table::make($pool, 1);
$table2->set($_**2 => $_**2) for 1..20;
- my $overlay = $table_copy->overlay($table2, APR::Pool->new);
+ my $overlay = $table_copy->overlay($table2, $sub_pool);
{
# see the comment for above's:
# $table_copy = $table->copy(APR::Pool->new);
--
Joe Schaefer
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Fix table copy & overlay tests
Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> I don't think we're supposed to be mixing
> table entries when there's no relation between
> the two table's pools. Here's a patch which
> fixes the tests; without it the tests segfault
> with apr's trunk compiled with --enable-pool-debug.
Hmm, mine is compiled that way and I see no segfault. But your patch makes
a perfect sense Joe.
+1.
may be also add a note in the overlay and copy pod entries?
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org