Author: stas
Date: Fri Dec 24 15:51:09 2004
New Revision: 123307

URL: http://svn.apache.org/viewcvs?view=rev&rev=123307
Log:
APR::URI: parse: make the pool object dependency 

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/t/lib/TestAPRlib/uri.pm
   perl/modperl/trunk/todo/release
   perl/modperl/trunk/xs/APR/URI/APR__URI.h
   perl/modperl/trunk/xs/maps/apr_functions.map
   perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=123307&p1=perl/modperl/trunk/Changes&r1=123306&p2=perl/modperl/trunk/Changes&r2=123307
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Fri Dec 24 15:51:09 2004
@@ -24,6 +24,7 @@
 - APR::IpSubnet: new
 - APR::Table: copy, overlay, make
 - APR::ThreadMutex: new
+- APR::URI: parse
 
 speed up the 'perl Makefile.PL' stage [Randy Kobes]:
  - reduce the number of calls to build_config() of

Modified: perl/modperl/trunk/t/lib/TestAPRlib/uri.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestAPRlib/uri.pm?view=diff&rev=123307&p1=perl/modperl/trunk/t/lib/TestAPRlib/uri.pm&r1=123306&p2=perl/modperl/trunk/t/lib/TestAPRlib/uri.pm&r2=123307
==============================================================================
--- perl/modperl/trunk/t/lib/TestAPRlib/uri.pm  (original)
+++ perl/modperl/trunk/t/lib/TestAPRlib/uri.pm  Fri Dec 24 15:51:09 2004
@@ -42,7 +42,7 @@
 my @keys_hostinfo = qw(user password hostname port);
 
 sub num_of_tests {
-    return 27;
+    return 36;
 }
 
 sub test {
@@ -157,6 +157,31 @@
     while (my($scheme, $port) = each %default_ports) {
         my $apr_port = APR::URI::port_of_scheme($scheme);
         ok t_cmp($apr_port, $port, "scheme: $scheme");
+    }
+
+    # parse + out-of-scope pools
+    {
+
+        my $url0 = sprintf "%s://%s:[EMAIL PROTECTED]:%d%s?%s#%s",
+            map { $url{$_}[0] } @keys_urls;
+        # warn "URL: $url\n";
+        my $hostinfo0 =  sprintf "%s:[EMAIL PROTECTED]:%d",
+            map { $url{$_}[0] } @keys_hostinfo;
+
+        require APR::Pool;
+        my $parsed = APR::URI->parse(APR::Pool->new, $url0);
+
+        # try to overwrite the temp pool data
+        require APR::Table;
+        my $table = APR::Table::make(APR::Pool->new, 50);
+        $table->set($_ => $_) for 'aa'..'za';
+
+        for my $method (keys %url) {
+            no strict 'refs';
+            ok t_cmp($parsed->$method, $url{$method}[0], $method);
+        }
+
+        ok t_cmp($parsed->hostinfo, $hostinfo0, "hostinfo");
     }
 }
 

Modified: perl/modperl/trunk/todo/release
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/release?view=diff&rev=123307&p1=perl/modperl/trunk/todo/release&r1=123306&p2=perl/modperl/trunk/todo/release&r2=123307
==============================================================================
--- perl/modperl/trunk/todo/release     (original)
+++ perl/modperl/trunk/todo/release     Fri Dec 24 15:51:09 2004
@@ -67,7 +67,4 @@
   
   Apache::RequestUtil:
   ? mpxs_Apache__RequestRec_new (having problems): Apache__RequestUtil.patch
-  
-  APR::URI
-  - mpxs_apr_uri_parse
 

Modified: perl/modperl/trunk/xs/APR/URI/APR__URI.h
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/URI/APR__URI.h?view=diff&rev=123307&p1=perl/modperl/trunk/xs/APR/URI/APR__URI.h&r1=123306&p2=perl/modperl/trunk/xs/APR/URI/APR__URI.h&r2=123307
==============================================================================
--- perl/modperl/trunk/xs/APR/URI/APR__URI.h    (original)
+++ perl/modperl/trunk/xs/APR/URI/APR__URI.h    Fri Dec 24 15:51:09 2004
@@ -36,16 +36,17 @@
 }
 
 static MP_INLINE
-apr_uri_t *mpxs_apr_uri_parse(pTHX_
-                              SV *classname,
-                              apr_pool_t *p,
-                              const char *uri_string)
+SV *mpxs_apr_uri_parse(pTHX_ SV *classname, SV *p_sv, const char *uri_string)
 {
+    apr_pool_t *p = mp_xs_sv2_APR__Pool(p_sv);
     modperl_uri_t *uri = modperl_uri_new(p);
 
     (void)apr_uri_parse(p, uri_string, &uri->uri);
 
-    return (apr_uri_t *)uri;
+    SV *uri_sv = sv_setref_pv(NEWSV(0, 0), "APR::URI", (void*)uri);
+    mpxs_add_pool_magic(uri_sv, p_sv);
+    
+    return uri_sv;
 }
 
 static MP_INLINE

Modified: perl/modperl/trunk/xs/maps/apr_functions.map
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/apr_functions.map?view=diff&rev=123307&p1=perl/modperl/trunk/xs/maps/apr_functions.map&r1=123306&p2=perl/modperl/trunk/xs/maps/apr_functions.map&r2=123307
==============================================================================
--- perl/modperl/trunk/xs/maps/apr_functions.map        (original)
+++ perl/modperl/trunk/xs/maps/apr_functions.map        Fri Dec 24 15:51:09 2004
@@ -584,8 +584,7 @@
 
 MODULE=APR::URI
 !apr_uri_parse_hostinfo
- apr_uri_t *:apr_uri_parse | mpxs_ | \
-             SV *:classname, p, uri | parse
+ SV *:apr_uri_parse | mpxs_ | SV *:classname, SV *:p_sv, uri | parse
  apr_uri_unparse | mpxs_ | \
                   uptr, flags=APR_URI_UNP_OMITPASSWORD | unparse
  #special case to set both uri->port and uri->port_str

Modified: perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm?view=diff&rev=123307&p1=perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm&r1=123306&p2=perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm&r2=123307
==============================================================================
--- perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm       
(original)
+++ perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm       Fri Dec 
24 15:51:09 2004
@@ -2,7 +2,7 @@
 
 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 # ! WARNING: generated by ModPerl::ParseSource/0.01
-# !          Fri Dec 24 18:22:05 2004
+# !          Fri Dec 24 18:39:57 2004
 # !          do NOT edit, any changes will be lost !
 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -7879,7 +7879,7 @@
     ]
   },
   {
-    'return_type' => 'apr_uri_t *',
+    'return_type' => 'SV *',
     'name' => 'mpxs_apr_uri_parse',
     'args' => [
       {
@@ -7891,8 +7891,8 @@
         'name' => 'classname'
       },
       {
-        'type' => 'apr_pool_t *',
-        'name' => 'p'
+        'type' => 'SV *',
+        'name' => 'p_sv'
       },
       {
         'type' => 'const char *',

Reply via email to