summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGreg Stein <gstein@apache.org>2001-02-18 03:58:53 +0100
committerGreg Stein <gstein@apache.org>2001-02-18 03:58:53 +0100
commitdd9b08e32169354e347fd4940733b805bc507c6c (patch)
tree08e866790b10ceb6b78c24213f2cd453507f093a /modules
parentChange a few "no" module to "most". Leave suexec: it must be explicitly (diff)
downloadapache2-dd9b08e32169354e347fd4940733b805bc507c6c.tar.xz
apache2-dd9b08e32169354e347fd4940733b805bc507c6c.zip
*) Introduce "ap_conf_vector_t" type to assist with legibility and provide
some type safety. (unfortunately, our old "void*" is type-safe with the new one, but over time we should be better) *) Propagate the new type to all appropriate functions. *) Random cleaning, whitespace, stylistic nits. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88225 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r--modules/aaa/mod_auth_digest.c5
-rw-r--r--modules/generators/mod_cgi.c18
-rw-r--r--modules/generators/mod_cgid.c28
-rw-r--r--modules/http/http_core.c16
-rw-r--r--modules/http/http_request.c107
-rw-r--r--modules/mappers/mod_alias.c13
-rw-r--r--modules/mappers/mod_negotiation.c6
-rw-r--r--modules/mappers/mod_rewrite.c32
-rw-r--r--modules/mappers/mod_userdir.c39
-rw-r--r--modules/metadata/mod_env.c41
-rw-r--r--modules/metadata/mod_headers.c39
11 files changed, 159 insertions, 185 deletions
diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c
index 3b1b66c4de..8c95d3385d 100644
--- a/modules/aaa/mod_auth_digest.c
+++ b/modules/aaa/mod_auth_digest.c
@@ -325,6 +325,8 @@ static void log_error_and_cleanup(char *msg, apr_status_t sts, server_rec *s)
cleanup_tables(NULL);
}
+#if APR_HAS_SHARED_MEMORY
+
static void initialize_tables(server_rec *s, apr_pool_t *ctx)
{
unsigned long idx;
@@ -392,6 +394,9 @@ static void initialize_tables(server_rec *s, apr_pool_t *ctx)
return;
}
+#endif /* APR_HAS_SHARED_MEMORY */
+
+
static void initialize_module(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c
index a189e75c44..073eddd422 100644
--- a/modules/generators/mod_cgi.c
+++ b/modules/generators/mod_cgi.c
@@ -158,8 +158,8 @@ static void *merge_cgi_config(apr_pool_t *p, void *basev, void *overridesv)
static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgi_server_conf *conf =
- (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module);
+ cgi_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgi_module);
conf->logname = arg;
return NULL;
@@ -169,8 +169,8 @@ static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy,
const char *arg)
{
server_rec *s = cmd->server;
- cgi_server_conf *conf =
- (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module);
+ cgi_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgi_module);
conf->logbytes = atol(arg);
return NULL;
@@ -180,8 +180,8 @@ static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy,
const char *arg)
{
server_rec *s = cmd->server;
- cgi_server_conf *conf =
- (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module);
+ cgi_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgi_module);
conf->bufbytes = atoi(arg);
return NULL;
@@ -371,10 +371,12 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
apr_procattr_t *procattr;
apr_proc_t *procnew;
apr_status_t rc = APR_SUCCESS;
+
#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \
defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
- core_dir_config *conf;
- conf = (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module);
+
+ core_dir_config *conf = ap_get_module_config(r->per_dir_config,
+ &core_module);
#endif
diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c
index c8d2858f94..11868a5923 100644
--- a/modules/generators/mod_cgid.c
+++ b/modules/generators/mod_cgid.c
@@ -440,8 +440,8 @@ static int cgid_server(void *data)
mode_t omask;
apr_socklen_t len;
server_rec *main_server = data;
- cgid_server_conf *sconf = (cgid_server_conf *)ap_get_module_config(
- main_server->module_config, &cgid_module);
+ cgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+ &cgid_module);
apr_signal(SIGCHLD, SIG_IGN);
if (unlink(sconf->sockname) < 0 && errno != ENOENT) {
@@ -640,8 +640,8 @@ static void *merge_cgid_config(apr_pool_t *p, void *basev, void *overridesv)
static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->logname = arg;
return NULL;
@@ -650,8 +650,8 @@ static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->logbytes = atol(arg);
return NULL;
@@ -660,8 +660,8 @@ static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, const char
static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->bufbytes = atoi(arg);
return NULL;
@@ -670,8 +670,8 @@ static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, const char
static const char *set_script_socket(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->sockname = ap_server_root_relative(cmd->pool, arg);
return NULL;
@@ -820,7 +820,6 @@ static int cgid_handler(request_rec *r)
apr_bucket_brigade *bb;
apr_bucket *b;
char argsbuffer[HUGE_STRING_LEN];
- void *sconf;
cgid_server_conf *conf;
int is_included;
int sd;
@@ -839,8 +838,7 @@ static int cgid_handler(request_rec *r)
return DECLINED;
}
- sconf = r->server->module_config;
- conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module);
+ conf = ap_get_module_config(r->server->module_config, &cgid_module);
is_included = !strcmp(r->protocol, "INCLUDED");
if ((argv0 = strrchr(r->filename, '/')) != NULL)
@@ -1125,8 +1123,8 @@ static int include_cmd(include_ctx_t *ctx, apr_bucket_brigade **bb, char *comman
apr_bucket *b;
struct sockaddr_un unix_addr;
apr_file_t *tempsock = NULL;
- void *sconf = r->server->module_config;
- cgid_server_conf *conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(r->server->module_config,
+ &cgid_module);
add_ssi_vars(r, f->next);
env = ap_create_environment(r->pool, r->subprocess_env);
diff --git a/modules/http/http_core.c b/modules/http/http_core.c
index ab0c12d87b..43b11a549b 100644
--- a/modules/http/http_core.c
+++ b/modules/http/http_core.c
@@ -148,7 +148,7 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir)
conf->limit_req_body = 0;
conf->limit_xml_body = AP_LIMIT_UNSET;
- conf->sec = apr_array_make(a, 2, sizeof(void *));
+ conf->sec = apr_array_make(a, 2, sizeof(ap_conf_vector_t *));
#ifdef WIN32
conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET;
#endif
@@ -318,8 +318,8 @@ static void *create_core_server_config(apr_pool_t *a, server_rec *s)
#endif
conf->access_name = is_virtual ? NULL : DEFAULT_ACCESS_FNAME;
conf->ap_document_root = is_virtual ? NULL : DOCUMENT_LOCATION;
- conf->sec = apr_array_make(a, 40, sizeof(void *));
- conf->sec_url = apr_array_make(a, 40, sizeof(void *));
+ conf->sec = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
+ conf->sec_url = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
return (void *)conf;
}
@@ -406,7 +406,7 @@ AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config)
* components (where a "special" section has infinite components).
*/
struct reorder_sort_rec {
- void *elt;
+ ap_conf_vector_t *elt;
int orig_index;
};
@@ -417,8 +417,8 @@ static int reorder_sorter(const void *va, const void *vb)
core_dir_config *core_a;
core_dir_config *core_b;
- core_a = (core_dir_config *)ap_get_module_config(a->elt, &core_module);
- core_b = (core_dir_config *)ap_get_module_config(b->elt, &core_module);
+ core_a = ap_get_module_config(a->elt, &core_module);
+ core_b = ap_get_module_config(b->elt, &core_module);
if (IS_SPECIAL(core_a)) {
if (!IS_SPECIAL(core_b)) {
return 1;
@@ -448,14 +448,14 @@ void ap_core_reorder_directories(apr_pool_t *p, server_rec *s)
apr_array_header_t *sec;
struct reorder_sort_rec *sortbin;
int nelts;
- void **elts;
+ ap_conf_vector_t **elts;
int i;
apr_pool_t *tmp;
sconf = ap_get_module_config(s->module_config, &core_module);
sec = sconf->sec;
nelts = sec->nelts;
- elts = (void **)sec->elts;
+ elts = (ap_conf_vector_t **)sec->elts;
/* we have to allocate tmp space to do a stable sort */
apr_pool_create(&tmp, p);
diff --git a/modules/http/http_request.c b/modules/http/http_request.c
index 4b7d0811ab..8fb92799d0 100644
--- a/modules/http/http_request.c
+++ b/modules/http/http_request.c
@@ -331,9 +331,9 @@ static int get_path_info(request_rec *r)
static int directory_walk(request_rec *r)
{
core_server_config *sconf = ap_get_module_config(r->server->module_config,
- &core_module);
- void *per_dir_defaults = r->server->lookup_defaults;
- void **sec = (void **) sconf->sec->elts;
+ &core_module);
+ ap_conf_vector_t *per_dir_defaults = r->server->lookup_defaults;
+ ap_conf_vector_t **sec = (ap_conf_vector_t **) sconf->sec->elts;
int num_sec = sconf->sec->nelts;
char *test_filename;
char *test_dirname;
@@ -343,6 +343,9 @@ static int directory_walk(request_rec *r)
#if defined(HAVE_UNC_PATHS) || defined(NETWARE)
unsigned iStart = 1;
#endif
+ ap_conf_vector_t *entry_config;
+ ap_conf_vector_t *this_conf;
+ core_dir_config *entry_core;
/*
* Are we dealing with a file? If not, we can (hopefuly) safely assume we
@@ -372,16 +375,12 @@ static int directory_walk(request_rec *r)
if (!ap_os_is_path_absolute(r->filename))
{
- void *this_conf, *entry_config;
- core_dir_config *entry_core;
- char *entry_dir;
+ const char *entry_dir;
for (j = 0; j < num_sec; ++j) {
entry_config = sec[j];
-
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_dir = entry_core->d;
this_conf = NULL;
@@ -398,8 +397,8 @@ static int directory_walk(request_rec *r)
if (this_conf)
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults,
- this_conf);
+ per_dir_defaults,
+ this_conf);
}
r->per_dir_config = per_dir_defaults;
@@ -410,7 +409,7 @@ static int directory_walk(request_rec *r)
/* XXX This needs to be rolled into APR, the APR function will not
* be allowed to fold the case of any non-existant segment of the path:
*/
- r->filename = ap_os_case_canonical_filename(r->pool, r->filename);
+ r->filename = ap_os_case_canonical_filename(r->pool, r->filename);
/* TODO This is rather silly right here, we should simply be setting
* filename and path_info at the end of our directory_walk
@@ -420,10 +419,10 @@ static int directory_walk(request_rec *r)
return res;
}
- /* XXX This becomes mute, and will already happen above for elements
+ /* XXX This becomes moot, and will already happen above for elements
* that actually exist:
*/
- r->filename = ap_os_canonical_filename(r->pool, r->filename);
+ r->filename = ap_os_canonical_filename(r->pool, r->filename);
test_filename = apr_pstrdup(r->pool, r->filename);
@@ -500,8 +499,8 @@ static int directory_walk(request_rec *r)
j = 0;
for (; i <= num_dirs; ++i) {
int overrides_here;
- core_dir_config *core_dir = (core_dir_config *)
- ap_get_module_config(per_dir_defaults, &core_module);
+ core_dir_config *core_dir = ap_get_module_config(per_dir_defaults,
+ &core_module);
/*
* XXX: this could be made faster by only copying the next component
@@ -530,13 +529,10 @@ static int directory_walk(request_rec *r)
*/
for (; j < num_sec; ++j) {
- void *entry_config = sec[j];
- core_dir_config *entry_core;
char *entry_dir;
- void *this_conf;
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_config = sec[j];
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_dir = entry_core->d;
if (entry_core->r
@@ -546,10 +542,11 @@ static int directory_walk(request_rec *r)
* XXX: The net test may be wrong... may fail ap_os_is_path_absolute
*/
|| (entry_core->d_components > 1
- && entry_core->d_components > i))
+ && entry_core->d_components > i)
#else
- || entry_core->d_components > i)
-#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
+ || entry_core->d_components > i
+#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
+ )
break;
this_conf = NULL;
@@ -563,10 +560,10 @@ static int directory_walk(request_rec *r)
if (this_conf) {
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults,
- this_conf);
- core_dir = (core_dir_config *)
- ap_get_module_config(per_dir_defaults, &core_module);
+ per_dir_defaults,
+ this_conf);
+ core_dir = ap_get_module_config(per_dir_defaults,
+ &core_module);
}
#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE)
/* So that other top-level directory sections (e.g. "e:/") aren't
@@ -587,11 +584,11 @@ static int directory_walk(request_rec *r)
if (i >= iStart)
#endif
if (overrides_here) {
- void *htaccess_conf = NULL;
+ ap_conf_vector_t *htaccess_conf = NULL;
res = ap_parse_htaccess(&htaccess_conf, r, overrides_here,
- apr_pstrdup(r->pool, test_dirname),
- sconf->access_name);
+ apr_pstrdup(r->pool, test_dirname),
+ sconf->access_name);
if (res)
return res;
@@ -610,17 +607,15 @@ static int directory_walk(request_rec *r)
* regexes.
*/
for (; j < num_sec; ++j) {
- void *entry_config = sec[j];
- core_dir_config *entry_core;
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_config = sec[j];
+ entry_core = ap_get_module_config(entry_config, &core_module);
if (entry_core->r) {
if (!ap_regexec(entry_core->r, test_dirname, 0, NULL, REG_NOTEOL)) {
- per_dir_defaults =
- ap_merge_per_dir_configs(r->pool, per_dir_defaults,
- entry_config);
+ per_dir_defaults = ap_merge_per_dir_configs(r->pool,
+ per_dir_defaults,
+ entry_config);
}
}
}
@@ -648,12 +643,13 @@ static int directory_walk(request_rec *r)
static int location_walk(request_rec *r)
{
core_server_config *sconf = ap_get_module_config(r->server->module_config,
- &core_module);
- void *per_dir_defaults = r->per_dir_config;
- void **url = (void **) sconf->sec_url->elts;
+ &core_module);
+ ap_conf_vector_t *per_dir_defaults = r->per_dir_config;
+ ap_conf_vector_t **url = (ap_conf_vector_t **) sconf->sec_url->elts;
int len, num_url = sconf->sec_url->nelts;
char *test_location;
- void *this_conf, *entry_config;
+ ap_conf_vector_t *this_conf;
+ ap_conf_vector_t *entry_config;
core_dir_config *entry_core;
char *entry_url;
int j;
@@ -684,8 +680,7 @@ static int location_walk(request_rec *r)
entry_config = url[j];
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_url = entry_core->d;
len = strlen(entry_url);
@@ -702,13 +697,14 @@ static int location_walk(request_rec *r)
}
}
else if (!strncmp(test_location, entry_url, len) &&
- (entry_url[len - 1] == '/' ||
- test_location[len] == '/' || test_location[len] == '\0'))
+ (entry_url[len - 1] == '/' ||
+ test_location[len] == '/' || test_location[len] == '\0'))
this_conf = entry_config;
if (this_conf)
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults, this_conf);
+ per_dir_defaults,
+ this_conf);
}
r->per_dir_config = per_dir_defaults;
@@ -717,9 +713,10 @@ static int location_walk(request_rec *r)
static int file_walk(request_rec *r)
{
- core_dir_config *conf = ap_get_module_config(r->per_dir_config, &core_module);
- void *per_dir_defaults = r->per_dir_config;
- void **file = (void **) conf->sec->elts;
+ core_dir_config *conf = ap_get_module_config(r->per_dir_config,
+ &core_module);
+ ap_conf_vector_t *per_dir_defaults = r->per_dir_config;
+ ap_conf_vector_t **file = (ap_conf_vector_t **) conf->sec->elts;
int num_files = conf->sec->nelts;
char *test_file;
@@ -735,7 +732,8 @@ static int file_walk(request_rec *r)
/* Go through the file entries, and check for matches. */
if (num_files) {
- void *this_conf, *entry_config;
+ ap_conf_vector_t *this_conf;
+ ap_conf_vector_t *entry_config;
core_dir_config *entry_core;
char *entry_file;
int j;
@@ -747,8 +745,7 @@ static int file_walk(request_rec *r)
entry_config = file[j];
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_file = entry_core->d;
this_conf = NULL;
@@ -768,8 +765,8 @@ static int file_walk(request_rec *r)
if (this_conf)
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults,
- this_conf);
+ per_dir_defaults,
+ this_conf);
}
r->per_dir_config = per_dir_defaults;
}
diff --git a/modules/mappers/mod_alias.c b/modules/mappers/mod_alias.c
index e512dff8f5..a5752e3c1e 100644
--- a/modules/mappers/mod_alias.c
+++ b/modules/mappers/mod_alias.c
@@ -138,8 +138,8 @@ static const char *add_alias_internal(cmd_parms *cmd, void *dummy,
int use_regex)
{
server_rec *s = cmd->server;
- alias_server_conf *conf =
- (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module);
+ alias_server_conf *conf = ap_get_module_config(s->module_config,
+ &alias_module);
alias_entry *new = apr_array_push(conf->aliases);
/* XX r can NOT be relative to DocumentRoot here... compat bug. */
@@ -182,8 +182,8 @@ static const char *add_redirect_internal(cmd_parms *cmd,
{
alias_entry *new;
server_rec *s = cmd->server;
- alias_server_conf *serverconf =
- (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module);
+ alias_server_conf *serverconf = ap_get_module_config(s->module_config,
+ &alias_module);
int status = (int) (long) cmd->info;
regex_t *r = NULL;
const char *f = arg2;
@@ -377,9 +377,8 @@ static char *try_alias_list(request_rec *r, apr_array_header_t *aliases, int doe
static int translate_alias_redir(request_rec *r)
{
- void *sconf = r->server->module_config;
- alias_server_conf *serverconf =
- (alias_server_conf *) ap_get_module_config(sconf, &alias_module);
+ ap_conf_vector_t *sconf = r->server->module_config;
+ alias_server_conf *serverconf = ap_get_module_config(sconf, &alias_module);
char *ret;
int status;
diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c
index 48fb9619cb..55de2e5758 100644
--- a/modules/mappers/mod_negotiation.c
+++ b/modules/mappers/mod_negotiation.c
@@ -127,10 +127,8 @@ static const char *set_language_priority(cmd_parms *cmd, void *n,
static const char *cache_negotiated_docs(cmd_parms *cmd, void *dummy,
int arg)
{
- void *server_conf = cmd->server->module_config;
-
- ap_set_module_config(server_conf, &negotiation_module,
- (arg ? "Cache" : NULL));
+ ap_set_module_config(cmd->server->module_config, &negotiation_module,
+ (arg ? "Cache" : NULL));
return NULL;
}
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 1b47b767f7..c0ab7cc4c3 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -347,9 +347,7 @@ static const char *cmd_rewriteengine(cmd_parms *cmd,
rewrite_perdir_conf *dconf = in_dconf;
rewrite_server_conf *sconf;
- sconf =
- (rewrite_server_conf *)ap_get_module_config(cmd->server->module_config,
- &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
if (cmd->path == NULL) { /* is server command */
sconf->state = (flag ? ENGINE_ENABLED : ENGINE_DISABLED);
@@ -368,8 +366,7 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd,
rewrite_server_conf *sconf;
const char *err;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
if (cmd->path == NULL) { /* is server command */
err = cmd_rewriteoptions_setoption(cmd->pool,
@@ -400,8 +397,7 @@ static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, const char *a1)
{
rewrite_server_conf *sconf;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
sconf->rewritelogfile = a1;
@@ -412,8 +408,7 @@ static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *
{
rewrite_server_conf *sconf;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
sconf->rewriteloglevel = atoi(a1);
@@ -427,8 +422,7 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1,
rewritemap_entry *newmap;
apr_finfo_t st;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
newmap = apr_array_push(sconf->rewritemaps);
@@ -546,8 +540,7 @@ static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf,
const char *err;
int rc;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
/* make a new entry in the internal temporary rewrite rule list */
if (cmd->path == NULL) { /* is server command */
@@ -691,8 +684,7 @@ static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf,
const char *err;
int mode;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
/* make a new entry in the internal rewrite rule list */
if (cmd->path == NULL) { /* is server command */
@@ -1012,7 +1004,6 @@ static void init_child(apr_pool_t *p, server_rec *s)
static int hook_uri2file(request_rec *r)
{
- void *sconf;
rewrite_server_conf *conf;
const char *var;
const char *thisserver;
@@ -1030,9 +1021,7 @@ static int hook_uri2file(request_rec *r)
/*
* retrieve the config structures
*/
- sconf = r->server->module_config;
- conf = (rewrite_server_conf *)ap_get_module_config(sconf,
- &rewrite_module);
+ conf = ap_get_module_config(r->server->module_config, &rewrite_module);
/*
* only do something under runtime if the engine is really enabled,
@@ -2634,7 +2623,6 @@ static char *expand_tildepaths(request_rec *r, char *uri)
static char *lookup_map(request_rec *r, char *name, char *key)
{
- void *sconf;
rewrite_server_conf *conf;
apr_array_header_t *rewritemaps;
rewritemap_entry *entries;
@@ -2645,9 +2633,7 @@ static char *lookup_map(request_rec *r, char *name, char *key)
int i;
/* get map configuration */
- sconf = r->server->module_config;
- conf = (rewrite_server_conf *)ap_get_module_config(sconf,
- &rewrite_module);
+ conf = ap_get_module_config(r->server->module_config, &rewrite_module);
rewritemaps = conf->rewritemaps;
entries = (rewritemap_entry *)rewritemaps->elts;
diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c
index 6708bc51a7..91e4b58c1b 100644
--- a/modules/mappers/mod_userdir.c
+++ b/modules/mappers/mod_userdir.c
@@ -122,12 +122,12 @@
module userdir_module;
-typedef struct userdir_config {
+typedef struct {
int globally_disabled;
char *userdir;
apr_table_t *enabled_users;
apr_table_t *disabled_users;
-} userdir_config;
+} userdir_config;
/*
* Server config for this module: global disablement flag, a list of usernames
@@ -137,14 +137,14 @@ typedef struct userdir_config {
static void *create_userdir_config(apr_pool_t *p, server_rec *s)
{
- userdir_config
- * newcfg = (userdir_config *) apr_pcalloc(p, sizeof(userdir_config));
+ userdir_config *newcfg = apr_pcalloc(p, sizeof(*newcfg));
newcfg->globally_disabled = 0;
newcfg->userdir = DEFAULT_USER_DIR;
newcfg->enabled_users = apr_table_make(p, 4);
newcfg->disabled_users = apr_table_make(p, 4);
- return (void *) newcfg;
+
+ return newcfg;
}
#define O_DEFAULT 0
@@ -153,15 +153,10 @@ static void *create_userdir_config(apr_pool_t *p, server_rec *s)
static const char *set_user_dir(cmd_parms *cmd, void *dummy, const char *arg)
{
- userdir_config
- * s_cfg = (userdir_config *) ap_get_module_config
- (
- cmd->server->module_config,
- &userdir_module
- );
+ userdir_config *s_cfg = ap_get_module_config(cmd->server->module_config,
+ &userdir_module);
char *username;
- const char
- *usernames = arg;
+ const char *usernames = arg;
char *kw = ap_getword_conf(cmd->pool, &usernames);
apr_table_t *usertable;
@@ -219,9 +214,9 @@ static const command_rec userdir_cmds[] = {
static int translate_userdir(request_rec *r)
{
- void *server_conf = r->server->module_config;
- const userdir_config *s_cfg =
- (userdir_config *) ap_get_module_config(server_conf, &userdir_module);
+ ap_conf_vector_t *server_conf = r->server->module_config;
+ const userdir_config *s_cfg = ap_get_module_config(server_conf,
+ &userdir_module);
char *name = r->uri;
const char *userdirs = s_cfg->userdir;
const char *w, *dname;
@@ -233,11 +228,7 @@ static int translate_userdir(request_rec *r)
* If the URI doesn't match our basic pattern, we've nothing to do with
* it.
*/
- if (
- (s_cfg->userdir == NULL) ||
- (name[0] != '/') ||
- (name[1] != '~')
- ) {
+ if (s_cfg->userdir == NULL || name[0] != '/' || name[1] != '~') {
return DECLINED;
}
@@ -271,10 +262,8 @@ static int translate_userdir(request_rec *r)
* If there's a global interdiction on UserDirs, check to see if this
* name is one of the Blessed.
*/
- if (
- s_cfg->globally_disabled &&
- (apr_table_get(s_cfg->enabled_users, w) == NULL)
- ) {
+ if (s_cfg->globally_disabled
+ && apr_table_get(s_cfg->enabled_users, w) == NULL) {
return DECLINED;
}
diff --git a/modules/metadata/mod_env.c b/modules/metadata/mod_env.c
index b70065df34..ebe112b859 100644
--- a/modules/metadata/mod_env.c
+++ b/modules/metadata/mod_env.c
@@ -122,20 +122,20 @@ module AP_MODULE_DECLARE_DATA env_module;
static void *create_env_dir_config(apr_pool_t *p, char *dummy)
{
- env_dir_config_rec *new =
- (env_dir_config_rec *) apr_palloc(p, sizeof(env_dir_config_rec));
- new->vars = apr_table_make(p, 50);
- new->unsetenv = "";
- new->vars_present = 0;
- return (void *) new;
+ env_dir_config_rec *conf = apr_palloc(p, sizeof(*conf));
+
+ conf->vars = apr_table_make(p, 50);
+ conf->unsetenv = "";
+ conf->vars_present = 0;
+
+ return conf;
}
static void *merge_env_dir_configs(apr_pool_t *p, void *basev, void *addv)
{
- env_dir_config_rec *base = (env_dir_config_rec *) basev;
- env_dir_config_rec *add = (env_dir_config_rec *) addv;
- env_dir_config_rec *new =
- (env_dir_config_rec *) apr_palloc(p, sizeof(env_dir_config_rec));
+ env_dir_config_rec *base = basev;
+ env_dir_config_rec *add = addv;
+ env_dir_config_rec *newconf = apr_palloc(p, sizeof(*newconf));
apr_table_t *new_table;
apr_table_entry_t *elts;
@@ -170,17 +170,17 @@ static void *merge_env_dir_configs(apr_pool_t *p, void *basev, void *addv)
uenv = ap_getword_conf(p, &unset);
}
- new->vars = new_table;
+ newconf->vars = new_table;
- new->vars_present = base->vars_present || add->vars_present;
+ newconf->vars_present = base->vars_present || add->vars_present;
- return new;
+ return newconf;
}
static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_,
const char *arg)
{
- env_dir_config_rec *sconf=sconf_;
+ env_dir_config_rec *sconf = sconf_;
apr_table_t *vars = sconf->vars;
char *env_var;
char *name_ptr;
@@ -199,7 +199,7 @@ static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_,
static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
const char *arg)
{
- env_dir_config_rec *sconf=sconf_;
+ env_dir_config_rec *sconf = sconf_;
apr_table_t *vars = sconf->vars;
char *name, *value;
@@ -224,11 +224,12 @@ static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
static const char *add_env_module_vars_unset(cmd_parms *cmd, void *sconf_,
const char *arg)
{
- env_dir_config_rec *sconf=sconf_;
+ env_dir_config_rec *sconf = sconf_;
+
+ sconf->unsetenv = sconf->unsetenv
+ ? apr_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL)
+ : arg;
- sconf->unsetenv = sconf->unsetenv ?
- apr_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL) :
- arg;
return NULL;
}
@@ -260,7 +261,7 @@ static int fixup_env_module(request_rec *r)
static void register_hooks(apr_pool_t *p)
{
- ap_hook_fixups(fixup_env_module,NULL,NULL,APR_HOOK_MIDDLE);
+ ap_hook_fixups(fixup_env_module, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA env_module =
diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c
index d79d0027a2..20edf23ae1 100644
--- a/modules/metadata/mod_headers.c
+++ b/modules/metadata/mod_headers.c
@@ -138,39 +138,40 @@ module AP_MODULE_DECLARE_DATA headers_module;
static void *create_headers_config(apr_pool_t *p, server_rec *s)
{
- headers_conf *a =
- (headers_conf *) apr_pcalloc(p, sizeof(headers_conf));
+ headers_conf *conf = apr_pcalloc(p, sizeof(*conf));
- a->headers = apr_array_make(p, 2, sizeof(header_entry));
- return a;
+ conf->headers = apr_array_make(p, 2, sizeof(header_entry));
+
+ return conf;
}
static void *create_headers_dir_config(apr_pool_t *p, char *d)
{
- return (headers_conf *) create_headers_config(p, NULL);
+ return create_headers_config(p, NULL);
}
static void *merge_headers_config(apr_pool_t *p, void *basev, void *overridesv)
{
- headers_conf *a =
- (headers_conf *) apr_pcalloc(p, sizeof(headers_conf));
- headers_conf *base = (headers_conf *) basev, *overrides = (headers_conf *) overridesv;
+ headers_conf *newconf = apr_pcalloc(p, sizeof(*newconf));
+ headers_conf *base = basev;
+ headers_conf *overrides = overridesv;
- a->headers = apr_array_append(p, base->headers, overrides->headers);
+ newconf->headers = apr_array_append(p, base->headers, overrides->headers);
- return a;
+ return newconf;
}
static const char *header_cmd(cmd_parms *cmd, void *indirconf,
- const char *action, const char *inhdr, const char *value)
+ const char *action, const char *inhdr,
+ const char *value)
{
headers_conf *dirconf = indirconf;
char *hdr = apr_pstrdup(cmd->pool, inhdr);
header_entry *new;
server_rec *s = cmd->server;
- headers_conf *serverconf =
- (headers_conf *) ap_get_module_config(s->module_config, &headers_module);
+ headers_conf *serverconf = ap_get_module_config(s->module_config,
+ &headers_module);
char *colon;
if (cmd->path) {
@@ -240,12 +241,10 @@ static void do_headers_fixup(request_rec *r, apr_array_header_t *headers)
static int fixup_headers(request_rec *r)
{
- void *sconf = r->server->module_config;
- headers_conf *serverconf =
- (headers_conf *) ap_get_module_config(sconf, &headers_module);
- void *dconf = r->per_dir_config;
- headers_conf *dirconf =
- (headers_conf *) ap_get_module_config(dconf, &headers_module);
+ headers_conf *serverconf = ap_get_module_config(r->server->module_config,
+ &headers_module);
+ headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
+ &headers_module);
do_headers_fixup(r, serverconf->headers);
do_headers_fixup(r, dirconf->headers);
@@ -255,7 +254,7 @@ static int fixup_headers(request_rec *r)
static void register_hooks(apr_pool_t *p)
{
- ap_hook_fixups(fixup_headers,NULL,NULL,APR_HOOK_MIDDLE);
+ ap_hook_fixups(fixup_headers, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA headers_module =