Introduce ap_(get|set)_core_module_config() functions/macros and use them

everywhere.

We know that the core module has module_index 0. Therefore we can save
some pointer operations in ap_get_module_config(cv, &core_module) and
ap_set_module_config(cv, &core_module, val). As these are called rather often,
this may actually have some (small) measurable effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2011-06-06 21:26:56 +00:00
parent 8b98cff952
commit c9fd2623da
43 changed files with 217 additions and 155 deletions

View File

@ -19,6 +19,7 @@
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
/* Possibly get rid of the macros we defined in httpd.h */
#if defined(strchr)
@ -106,6 +107,17 @@ AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
return ((void **)cv)[m->module_index];
}
#if defined(ap_get_core_module_config)
#undef ap_get_core_module_config
AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv);
#endif
AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv)
{
return ((void **)cv)[AP_CORE_MODULE_INDEX];
}
#if defined(ap_get_server_module_loglevel)
#undef ap_get_server_module_loglevel
AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index);
@ -200,3 +212,14 @@ AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
{
((void **)cv)[m->module_index] = val;
}
#if defined(ap_set_core_module_config)
#undef ap_set_core_module_config
AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val);
#endif
AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val)
{
((void **)cv)[AP_CORE_MODULE_INDEX] = val;
}