perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl modperl_util.c
Date Mon, 19 Nov 2001 23:24:47 GMT
dougm       01/11/19 15:24:46

  Modified:    src/modules/perl modperl_util.c
  Log:
  give modperl_sv2pool more to choose from
  
  Revision  Changes    Path
  1.31      +28 -10    modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- modperl_util.c	2001/11/06 18:39:41	1.30
  +++ modperl_util.c	2001/11/19 23:24:46	1.31
  @@ -170,15 +170,21 @@
   
   apr_pool_t *modperl_sv2pool(pTHX_ SV *obj)
   {
  -    char *classname;
  +    apr_pool_t *p = NULL;
  +    char *classname = NULL;
  +    IV ptr = 0;
   
  -    if (!(SvROK(obj) && (SvTYPE(SvRV(obj)) == SVt_PVMG))) {
  -        return NULL;
  +    if ((SvROK(obj) && (SvTYPE(SvRV(obj)) == SVt_PVMG))) {
  +        ptr = SvObjIV(obj);
  +        classname = SvCLASS(obj);
       }
  -
  -    classname = SvCLASS(obj);
  +    else {
  +        STRLEN len;
  +        classname = SvPV(obj, len);
  +    }
   
       if (*classname != 'A') {
  +        /* XXX: could be a subclass */
           return NULL;
       }
   
  @@ -187,25 +193,37 @@
           switch (*classname) {
             case 'P':
               if (strEQ(classname, "Pool")) {
  -                return (apr_pool_t *)SvObjIV(obj);
  +                p = (apr_pool_t *)ptr;
               }
  +            break;
             default:
  -            return NULL;
  +            break;
           };
       }
       else if (strnEQ(classname, "Apache::", 8)) {
           classname += 8;
           switch (*classname) {
  +          case 'C':
  +            if (strEQ(classname, "Connection")) {
  +                p = ptr ? ((conn_rec *)ptr)->pool : NULL;
  +            }
  +            break;
             case 'R':
               if (strEQ(classname, "RequestRec")) {
  -                return ((request_rec *)SvObjIV(obj))->pool;
  +                p = ptr ? ((request_rec *)ptr)->pool : NULL;
  +            }
  +            break;
  +          case 'S':
  +            if (strEQ(classname, "Server")) {
  +                p = ptr ? ((server_rec *)ptr)->process->pconf : NULL;
               }
  +            break;
             default:
  -            return NULL;
  +            break;
           };
       }
   
  -    return NULL;
  +    return p ? p : modperl_global_get_pconf();
   }
   
   char *modperl_apr_strerror(apr_status_t rv)
  
  
  

Mime
View raw message