dougm       01/03/13 16:37:53

  Modified:    src/modules/perl modperl_callback.c modperl_callback.h
                        modperl_filter.c
  Log:
  pass an AV** rather than AV* to modperl_handler_make_args(), which will create the 
newAV() if needed
  
  Revision  Changes    Path
  1.24      +11 -8     modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- modperl_callback.c        2001/03/14 00:20:52     1.23
  +++ modperl_callback.c        2001/03/14 00:37:52     1.24
  @@ -18,11 +18,15 @@
       return modperl_handler_new(p, h->name);
   }
   
  -void modperl_handler_make_args(pTHX_ AV *av, ...)
  +void modperl_handler_make_args(pTHX_ AV **avp, ...)
   {
       va_list args;
   
  -    va_start(args, av);
  +    if (!*avp) {
  +        *avp = newAV(); /* XXX: cache an intialized AV* per-request */
  +    }
  +
  +    va_start(args, avp);
   
       for (;;) {
           char *classname = va_arg(args, char *);
  @@ -51,7 +55,7 @@
               break;
           }
   
  -        av_push(av, sv);
  +        av_push(*avp, sv);
       }
   
       va_end(args);
  @@ -213,16 +217,15 @@
       MP_TRACE_h(MP_FUNC, "running %d %s handlers\n",
                  av->nelts, desc);
       handlers = (modperl_handler_t **)av->elts;
  -    av_args = newAV();
   
       switch (type) {
         case MP_HANDLER_TYPE_DIR:
         case MP_HANDLER_TYPE_SRV:
  -        modperl_handler_make_args(aTHX_ av_args,
  +        modperl_handler_make_args(aTHX_ &av_args,
                                     "Apache::RequestRec", r, NULL);
           break;
         case MP_HANDLER_TYPE_CONN:
  -        modperl_handler_make_args(aTHX_ av_args,
  +        modperl_handler_make_args(aTHX_ &av_args,
                                     "Apache::Connection", c, NULL);
           break;
         case MP_HANDLER_TYPE_FILE:
  @@ -235,7 +238,7 @@
                 ptemp = va_arg(args, apr_pool_t *);
                 va_end(args);
   
  -              modperl_handler_make_args(aTHX_ av_args,
  +              modperl_handler_make_args(aTHX_ &av_args,
                                           "Apache::Pool", pconf,
                                           "Apache::Pool", plog,
                                           "Apache::Pool", ptemp,
  @@ -254,7 +257,7 @@
                     p = pconf;
                 }
   
  -              modperl_handler_make_args(aTHX_ av_args,
  +              modperl_handler_make_args(aTHX_ &av_args,
                                           "Apache::Pool", pconf,
                                           "Apache::Server", s, NULL);
             }
  
  
  
  1.12      +1 -1      modperl-2.0/src/modules/perl/modperl_callback.h
  
  Index: modperl_callback.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- modperl_callback.h        2001/03/09 23:46:35     1.11
  +++ modperl_callback.h        2001/03/14 00:37:52     1.12
  @@ -21,7 +21,7 @@
   modperl_handler_t *modperl_handler_dup(apr_pool_t *p,
                                          modperl_handler_t *h);
   
  -void modperl_handler_make_args(pTHX_ AV *avp, ...);
  +void modperl_handler_make_args(pTHX_ AV **avp, ...);
   
   int modperl_callback(pTHX_ modperl_handler_t *handler, apr_pool_t *p,
                        AV *args);
  
  
  
  1.8       +2 -4      modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- modperl_filter.c  2001/03/14 00:03:29     1.7
  +++ modperl_filter.c  2001/03/14 00:37:52     1.8
  @@ -81,7 +81,7 @@
   
   int modperl_run_filter(modperl_filter_t *filter)
   {
  -    AV *args;
  +    AV *args = Nullav;
       int status;
       modperl_handler_t *handler =
           ((modperl_filter_ctx_t *)filter->f->ctx)->handler;
  @@ -93,9 +93,7 @@
   
       MP_dINTERP_SELECT(r, c, s);
   
  -    args = newAV();
  -
  -    modperl_handler_make_args(aTHX_ args,
  +    modperl_handler_make_args(aTHX_ &args,
                                 filter_classes[filter->mode], filter,
                                 NULL);
   
  
  
  

Reply via email to