httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] 7% to 25% performance improvement
Date Sun, 25 Jan 1998 02:17:05 GMT
On Sun, 25 Jan 1998, Rob Hartill wrote:

> On Sat, 24 Jan 1998, Dean Gaudet wrote:
> 
> > This patch is based on code submitted by Dmitry Khrustalev
> > <dima@bog.msu.su>.  The table_(set|add|merge) routines all do pstrdup() 
> > of their key and val.  But this isn't always required... in fact it's
> > almost never required.  In many of the cases where these routines are
> > called the key is a constant string, and the value has been constructed by
> > pstrcat() or getword() or something else which has already allocated in
> > the appropriate pool. 
> 
> bummer. It patched clean but mod_perl needs to be changed too:
> 
> perl_config.c: In function `mod_perl_dir_env':
> perl_config.c:167: dereferencing pointer to incomplete type
> perl_config.c:169: dereferencing pointer to incomplete type
> *** Error code 1

This would be due to the patch I put into the tree to clean up the table
API.

> =====
>   void mod_perl_dir_env(perl_dir_config *cld)
>   { 
>       if(MP_HASENV(cld)) { 
> *     table_entry *elts = (table_entry *)cld->env->elts;
>       int i;
> *     for (i = 0; i < cld->env->nelts; ++i) {
>           MP_TRACE(fprintf(stderr, "mod_perl_dir_env: %s=`%s'",
>                    elts[i].key, elts[i].val));
>           mp_setenv(elts[i].key, elts[i].val);
>       } 
>       MP_HASENV_off(cld); /* just doit once per-request */
>       }
>   }
> =====
> 
> what do I change it to ?

-     table_entry *elts = (table_entry *)cld->env->elts;
+     array_header *elts = table_elts(cld->env);


-     for (i = 0; i < cld->env->nelts; ++i) {
+     for (i = 0; i < elts->nelts; ++i) {

That's been the "correct" way to do it forever... and will work with
all versions of Apache.

Dean


Mime
View raw message