perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@apache.org
Subject svn commit: r386697 - in /perl/modperl/trunk: src/modules/perl/modperl_util.c src/modules/perl/modperl_util.h xs/Apache2/RequestUtil/Apache2__RequestUtil.h xs/tables/current/ModPerl/FunctionTable.pm
Date Fri, 17 Mar 2006 19:25:05 GMT
Author: gozer
Date: Fri Mar 17 11:25:04 2006
New Revision: 386697

URL: http://svn.apache.org/viewcvs?rev=386697&view=rev
Log:
Move r->pnotes logic to modperl_util.c, so it can be reused
more easily (upcoming c->pnotes)
 

Modified:
    perl/modperl/trunk/src/modules/perl/modperl_util.c
    perl/modperl/trunk/src/modules/perl/modperl_util.h
    perl/modperl/trunk/xs/Apache2/RequestUtil/Apache2__RequestUtil.h
    perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm

Modified: perl/modperl/trunk/src/modules/perl/modperl_util.c
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_util.c?rev=386697&r1=386696&r2=386697&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_util.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_util.c Fri Mar 17 11:25:04 2006
@@ -828,3 +828,29 @@
                           modperl_global_get_server_rec()->process->pool);
     return data ? *(int *)data : 0;
  }
+
+SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val, request_rec *r) {
+    SV *retval = Nullsv;
+
+    if (!*pnotes) {
+        *pnotes = newHV();
+    }
+
+    if (key) {
+        STRLEN len;
+        char *k = SvPV(key, len);
+
+        if (val) {
+            retval = *hv_store(*pnotes, k, len, SvREFCNT_inc(val), 0);
+        }
+        else if (hv_exists(*pnotes, k, len)) {
+            retval = *hv_fetch(*pnotes, k, len, FALSE);
+        }
+    }
+    else {
+        retval = newRV_inc((SV *)*pnotes);
+    }
+
+    return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
+}
+ 

Modified: perl/modperl/trunk/src/modules/perl/modperl_util.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_util.h?rev=386697&r1=386696&r2=386697&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_util.h (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_util.h Fri Mar 17 11:25:04 2006
@@ -145,4 +145,6 @@
 void modperl_restart_count_inc(server_rec *base_server);
 int  modperl_restart_count(void);
 
+SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val, request_rec *r);
+
 #endif /* MODPERL_UTIL_H */

Modified: perl/modperl/trunk/xs/Apache2/RequestUtil/Apache2__RequestUtil.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/Apache2/RequestUtil/Apache2__RequestUtil.h?rev=386697&r1=386696&r2=386697&view=diff
==============================================================================
--- perl/modperl/trunk/xs/Apache2/RequestUtil/Apache2__RequestUtil.h (original)
+++ perl/modperl/trunk/xs/Apache2/RequestUtil/Apache2__RequestUtil.h Fri Mar 17 11:25:04 2006
@@ -212,32 +212,12 @@
 SV *mpxs_Apache2__RequestRec_pnotes(pTHX_ request_rec *r, SV *key, SV *val)
 {
     MP_dRCFG;
-    SV *retval = NULL;
 
     if (!rcfg) {
         return &PL_sv_undef;
     }
-    if (!rcfg->pnotes) {
-        rcfg->pnotes = newHV();
-    }
-
-    if (key) {
-        STRLEN len;
-        char *k = SvPV(key, len);
-
-        if (val) {
-            retval = *hv_store(rcfg->pnotes, k, len,
-                               SvREFCNT_inc(val), 0);
-        }
-        else if (hv_exists(rcfg->pnotes, k, len)) {
-            retval = *hv_fetch(rcfg->pnotes, k, len, FALSE);
-        }
-    }
-    else {
-        retval = newRV_inc((SV *)rcfg->pnotes);
-    }
 
-    return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
+    return modperl_pnotes(aTHX_ &rcfg->pnotes, key, val, r);
 }
 
 #define mpxs_Apache2__RequestRec_dir_config(r, key, sv_val) \

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?rev=386697&r1=386696&r2=386697&view=diff
==============================================================================
--- perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm (original)
+++ perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm Fri Mar 17 11:25:04 2006
@@ -4413,6 +4413,32 @@
     ]
   },
   {
+    'return_type' => 'SV *',
+    'name' => 'modperl_pnotes',
+    'args' => [
+      {
+        'type' => 'PerlInterpreter *',
+        'name' => 'my_perl'
+      },
+      {
+        'type' => 'HV **',
+        'name' => 'pnotes'
+      },
+      {
+        'type' => 'SV *',
+        'name' => 'key'
+      },
+      {
+        'type' => 'SV *',
+        'name' => 'val'
+      },
+      {
+        'type' => 'request_rec *',
+        'name' => 'r'
+      }
+    ]    
+  }.
+  {
     'return_type' => 'int',
     'name' => 'modperl_post_config_handler',
     'args' => [



Mime
View raw message