perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Fix table copy & overlay tests
Date Fri, 13 May 2005 03:47:56 GMT
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


Mime
View raw message