httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: httpd-apreq/Request Request.xs
Date Wed, 11 Feb 2004 03:20:59 GMT
stas        2004/02/10 19:20:59

  Modified:    .        Changes typemap
               Cookie   Cookie.xs
               Request  Request.xs
  Log:
  added a proper implementation of the ithreads support. At the same
  time it should resolve the problem with perl 5.8.2 under threaded
  applications, since it no longer relies on the implicit context and
  passes aTHX around.
  
  Revision  Changes    Path
  1.61      +7 -0      httpd-apreq/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/Changes,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -u -r1.60 -r1.61
  --- Changes	27 Sep 2003 16:28:51 -0000	1.60
  +++ Changes	11 Feb 2004 03:20:59 -0000	1.61
  @@ -2,6 +2,13 @@
   
   =over 4
   
  +=item 1.31 - ongoing
  +
  +added a proper implementation of the ithreads support. At the same
  +time it should resolve the problem with perl 5.8.2 under threaded
  +applications, since it no longer relies on the implicit context and
  +passes aTHX around. [Stas]
  +
   =item 1.30 - September 27, 2003
   
   libapreq-1.3 is released.
  
  
  
  1.3       +2 -2      httpd-apreq/typemap
  
  Index: typemap
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/typemap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- typemap	12 Aug 2001 15:59:16 -0000	1.2
  +++ typemap	11 Feb 2004 03:20:59 -0000	1.3
  @@ -33,8 +33,8 @@
   	r = sv2request_rec($arg, \"$ntype\", cv)
   
   T_COOKIEOBJ
  -	c = sv_2cookie($arg)
  +	c = sv_2cookie(aTHX_ $arg)
   
   T_APROBJ
  -	req = sv_2apreq($arg)
  +	req = sv_2apreq(aTHX_ $arg)
   
  
  
  
  1.8       +7 -5      httpd-apreq/Cookie/Cookie.xs
  
  Index: Cookie.xs
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/Cookie/Cookie.xs,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- Cookie.xs	4 Jun 2001 17:16:37 -0000	1.7
  +++ Cookie.xs	11 Feb 2004 03:20:59 -0000	1.8
  @@ -1,3 +1,4 @@
  +#define PERL_NO_GET_CONTEXT     /* we want efficiency */
   #include "apache_cookie.h"
   
   #ifdef WIN32
  @@ -81,14 +82,14 @@
   
   typedef ApacheCookie * Apache__Cookie;
   
  -static SV *cookie_bless(ApacheCookie *c)
  +static SV *cookie_bless(pTHX_ ApacheCookie *c)
   {
       SV *sv = newSV(0); 
       sv_setref_pv(sv, "Apache::Cookie", (void*)c); 
       return sv;
   }
   
  -static ApacheCookie *sv_2cookie(SV *sv)
  +static ApacheCookie *sv_2cookie(pTHX_ SV *sv)
   {
       if (SvROK(sv) && sv_derived_from(sv, "Apache::Cookie")) { 
   	return (ApacheCookie *)SvIV((SV*)SvRV(sv)); 
  @@ -100,7 +101,7 @@
   
   #define cookie_push(c) \
       XPUSHs(sv_2mortal(newSVpv(c->name,0))); \
  -    XPUSHs(sv_2mortal(cookie_bless(c)))
  +    XPUSHs(sv_2mortal(cookie_bless(aTHX_ c)))
   
   #define ApacheCookie_name(c, val) \
   ApacheCookie_attr(c, "name", val)
  @@ -192,7 +193,7 @@
   	c = ApacheCookie_new(r, NULL);
       }
       else {
  -	c = sv_2cookie(sv);
  +	c = sv_2cookie(aTHX_ sv);
       }
   
       cookies = ApacheCookie_parse(c->r, string);
  @@ -207,7 +208,8 @@
   	    ApacheCookie *c = ApacheCookieJarFetch(cookies, i);
   
   	    if (c && c->name) {
  -		hv_store(hv, c->name, strlen(c->name), cookie_bless(c), FALSE);
  +		hv_store(hv, c->name, strlen(c->name),
  +                         cookie_bless(aTHX_ c), FALSE);
   	    }
   	}
           sv = newRV_noinc((SV*)hv); 
  
  
  
  1.38      +27 -15    httpd-apreq/Request/Request.xs
  
  Index: Request.xs
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/Request/Request.xs,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -u -r1.37 -r1.38
  --- Request.xs	5 Jul 2003 02:35:20 -0000	1.37
  +++ Request.xs	11 Feb 2004 03:20:59 -0000	1.38
  @@ -1,3 +1,4 @@
  +#define PERL_NO_GET_CONTEXT     /* we want efficiency */
   #include "apache_request.h"
   #include "patchlevel.h"
   
  @@ -86,10 +87,18 @@
   typedef struct {
       SV *data;
       SV *sub;
  +    PerlInterpreter *perl;
   } UploadHook;
   
   #define XsUploadHook       ((UploadHook *)RETVAL->hook_data)
   #define XsUploadHookNew(p) (void *)ap_pcalloc(p, sizeof(UploadHook))
  +
  +#ifdef USE_ITHREADS
  +#define XsUploadHookNew_perl XsUploadHook->perl = aTHX
  +#else
  +#define XsUploadHookNew_perl 
  +#endif
  +
   #define XsUploadHookSet(slot, sv) \
        if (RETVAL->hook_data) { \
            if (XsUploadHook->slot) { \
  @@ -98,6 +107,7 @@
        } \
        else { \
            RETVAL->hook_data = XsUploadHookNew(r->pool); \
  +         XsUploadHookNew_perl; \
            ap_register_cleanup(r->pool, (void*)XsUploadHook, \
                                upload_hook_cleanup, ap_null_cleanup); \
        } \
  @@ -134,7 +144,7 @@
   
   static char *r_keys[] = { "_r", "r", NULL };
   
  -static SV *r_key_sv(SV *in)
  +static SV *r_key_sv(pTHX_ SV *in)
   {
       SV *sv;
       int i;
  @@ -152,7 +162,7 @@
       return Nullsv;
   }
   
  -static ApacheRequest *sv_2apreq(SV *sv)
  +static ApacheRequest *sv_2apreq(pTHX_ SV *sv)
   {
       if (SvROK(sv) && sv_derived_from(sv, "Apache::Request")) { 
   	SV *obj = sv;
  @@ -160,7 +170,7 @@
   	switch (SvTYPE(SvRV(obj))) {
   	case SVt_PVHV :
               do {
  -                obj = r_key_sv(obj);
  +                obj = r_key_sv(aTHX_ obj);
               } while (SvROK(obj) && (SvTYPE(SvRV(obj)) == SVt_PVHV));
   	    break;
   	default:
  @@ -173,7 +183,7 @@
       }
   } 
   
  -static SV *upload_bless(ApacheUpload *upload) 
  +static SV *upload_bless(pTHX_ ApacheUpload *upload) 
   { 
       SV *sv = newSV(0);  
       sv_setref_pv(sv, "Apache::Upload", (void*)upload);  
  @@ -183,11 +193,10 @@
   static int upload_hook(void *ptr, char *buf, int len, ApacheUpload *upload)
   {
       UploadHook *hook = (UploadHook *)ptr;
  -
  -#ifdef dTHX
  -    dTHX;  /* crude 5005thread support */
  +#ifdef USE_ITHREADS
  +    dTHXa(hook->perl);
   #endif
  -
  +    
       if (!(upload->fp || ApacheRequest_tmpfile(upload->req, upload)))
           return -1; /* error */
   
  @@ -229,7 +238,10 @@
   static void upload_hook_cleanup(void *ptr)
   {
       UploadHook *hook = (UploadHook *)ptr;
  -
  +#ifdef USE_ITHREADS
  +    dTHXa(hook->perl);
  +#endif
  +    
       if (hook->sub) {
           SvREFCNT_dec(hook->sub);
           hook->sub = Nullsv;
  @@ -243,14 +255,14 @@
   #define upload_push(upload) \
       XPUSHs(sv_2mortal(upload_bless(upload))) 
   
  -static void apreq_add_magic(SV *sv, SV *obj, ApacheRequest *req)
  +static void apreq_add_magic(pTHX_ SV *sv, SV *obj, ApacheRequest *req)
   {
       sv_magic(SvRV(sv), obj, '~', "dummy", -1);
       SvMAGIC(SvRV(sv))->mg_ptr = (char *)req->r;
   }
   
   #ifdef CGI_COMPAT
  -static void register_uploads (ApacheRequest *req) {
  +static void register_uploads (pTHX_ ApacheRequest *req) {
       ApacheUpload *upload;
   
       for (upload = req->upload; upload; upload = upload->next) {
  @@ -287,7 +299,7 @@
       class = class; /* -Wall */ 
       robj = ST(1);
       RETVAL = ApacheRequest_new(r);
  -    register_uploads(RETVAL);
  +    register_uploads(aTHX_ RETVAL);
   
       for (i=2; i<items; i+=2) {
           char *key = SvPV(ST(i),na);
  @@ -333,7 +345,7 @@
       RETVAL
   
       CLEANUP:
  -    apreq_add_magic(ST(0), robj, RETVAL);
  +    apreq_add_magic(aTHX_ ST(0), robj, RETVAL);
   
   char *
   ApacheRequest_script_name(req)
  @@ -498,11 +510,11 @@
   	if (!uptr)
               XSRETURN_UNDEF;
   
  -	upload_push(uptr);
  +	upload_push(aTHX_ uptr);
       }
       else {
   	for (uptr = req->upload; uptr; uptr = uptr->next)
  -	    upload_push(uptr);
  +	    upload_push(aTHX_ uptr);
       }
   
   char *
  
  
  

Mime
View raw message