On Monday 07 May 2007 19:19, Philippe M. Chiasson wrote:
> Torsten Foertsch wrote:
> > On Sunday 06 May 2007 19:11, Torsten Foertsch wrote:
> >> [...]
> >
> > That happens if there is no handler configured at startup time but more
> > than one for the same phase at request time.
>
> if (ravp && !*ravp) {
> + /* initialize ravp either from avp or as an empty array */
> if (*avp) {
> /* merge with existing configured handlers */
> *ravp = apr_array_copy(p, *avp);
> @@ -437,6 +438,9 @@
> *ravp = modperl_handler_array_new(p);
> }
> }
> + else if (ravp /* && *ravp */) {
> + /* ravp is already initialized: do nothing */
> + }
> else if (!*avp) {
>
>
> Wouldn't something like:
>
> if (ravp && !*ravp) {
>
> }
>
> if (avp && !*avp) {
>
> }
I wanted to make it more understandable for the next one who reads the source.
ravp!=0 says: there is a rcfg, that means change that instead of avp
*ravp!=0 says: there are already handlers installed in rcfg
So an equal but shorter version would be
case MP_HANDLER_ACTION_PUSH:
if (ravp) {
if (!*ravp) {
/* initialize ravp either from avp or as an empty array */
if (*avp) {
/* merge with existing configured handlers */
*ravp = apr_array_copy(p, *avp);
}
else {
/* no request handlers have been previously pushed or set
*/
*ravp = modperl_handler_array_new(p);
}
}
}
else if (!*avp) {
/* directly modify the configuration at startup time */
*avp = modperl_handler_array_new(p);
}
break;
or
case MP_HANDLER_ACTION_PUSH:
if (ravp && !*ravp) {
/* initialize ravp either from avp or as an empty array */
if (*avp) {
/* merge with existing configured handlers */
*ravp = apr_array_copy(p, *avp);
}
else {
/* no request handlers have been previously pushed or set */
*ravp = modperl_handler_array_new(p);
}
}
else if (!ravp && !*avp) {
/* directly modify the configuration at startup time */
*avp = modperl_handler_array_new(p);
}
break;
The point is if ravp!=0 we must not change *avp.
Torsten
pgpGw819vhsKs.pgp
Description: PGP signature
