diff options
author | Yann Ylavic <ylavic@apache.org> | 2017-07-18 15:06:15 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2017-07-18 15:06:15 +0000 |
commit | 72658bb425a0542711334cbe599928de14c4c185 (patch) | |
tree | e0f28e913c77d2c3ccb485a8860c8c41c13353a4 | |
parent | 7f548a8cdae026d87acc140c342d47009a143d33 (diff) | |
download | httpd-72658bb425a0542711334cbe599928de14c4c185.tar.gz |
ap_server_config_defines and ap_server_{pre,post}_read_config are arrays of
*const* strings (must not change after being inserted), make it explicit.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1802309 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | server/config.c | 4 | ||||
-rw-r--r-- | server/main.c | 25 |
2 files changed, 16 insertions, 13 deletions
diff --git a/server/config.c b/server/config.c index b4326ff775..8c8acbcb2d 100644 --- a/server/config.c +++ b/server/config.c @@ -1722,14 +1722,14 @@ typedef struct { static apr_status_t arr_elts_getstr(void *buf, apr_size_t bufsiz, void *param) { arr_elts_param_t *arr_param = (arr_elts_param_t *)param; - char *elt; + const char *elt; /* End of array reached? */ if (++arr_param->curr_idx > arr_param->array->nelts) return APR_EOF; /* return the line */ - elt = ((char **)arr_param->array->elts)[arr_param->curr_idx - 1]; + elt = ((const char **)arr_param->array->elts)[arr_param->curr_idx - 1]; if (apr_cpystrn(buf, elt, bufsiz) - (char *)buf >= bufsiz - 1) return APR_ENOSPC; return APR_SUCCESS; diff --git a/server/main.c b/server/main.c index bda60827ca..5196903ce7 100644 --- a/server/main.c +++ b/server/main.c @@ -499,9 +499,12 @@ int main(int argc, const char * const argv[]) apr_pool_create(&pcommands, ap_pglobal); apr_pool_tag(pcommands, "pcommands"); - ap_server_pre_read_config = apr_array_make(pcommands, 1, sizeof(char *)); - ap_server_post_read_config = apr_array_make(pcommands, 1, sizeof(char *)); - ap_server_config_defines = apr_array_make(pcommands, 1, sizeof(char *)); + ap_server_pre_read_config = apr_array_make(pcommands, 1, + sizeof(const char *)); + ap_server_post_read_config = apr_array_make(pcommands, 1, + sizeof(const char *)); + ap_server_config_defines = apr_array_make(pcommands, 1, + sizeof(const char *)); error = ap_setup_prelinked_modules(process); if (error) { @@ -519,16 +522,16 @@ int main(int argc, const char * const argv[]) while ((rv = apr_getopt(opt, AP_SERVER_BASEARGS, &c, &opt_arg)) == APR_SUCCESS) { - char **new; + const char **new; switch (c) { case 'c': - new = (char **)apr_array_push(ap_server_post_read_config); + new = (const char **)apr_array_push(ap_server_post_read_config); *new = apr_pstrdup(pcommands, opt_arg); break; case 'C': - new = (char **)apr_array_push(ap_server_pre_read_config); + new = (const char **)apr_array_push(ap_server_pre_read_config); *new = apr_pstrdup(pcommands, opt_arg); break; @@ -537,7 +540,7 @@ int main(int argc, const char * const argv[]) break; case 'D': - new = (char **)apr_array_push(ap_server_config_defines); + new = (const char **)apr_array_push(ap_server_config_defines); *new = apr_pstrdup(pcommands, opt_arg); /* Setting -D DUMP_VHOSTS should work like setting -S */ if (strcmp(opt_arg, "DUMP_VHOSTS") == 0) @@ -563,7 +566,7 @@ int main(int argc, const char * const argv[]) break; case 'X': - new = (char **)apr_array_push(ap_server_config_defines); + new = (const char **)apr_array_push(ap_server_config_defines); *new = "DEBUG"; break; @@ -596,15 +599,15 @@ int main(int argc, const char * const argv[]) case 'S': ap_run_mode = AP_SQ_RM_CONFIG_DUMP; - new = (char **)apr_array_push(ap_server_config_defines); + new = (const char **)apr_array_push(ap_server_config_defines); *new = "DUMP_VHOSTS"; - new = (char **)apr_array_push(ap_server_config_defines); + new = (const char **)apr_array_push(ap_server_config_defines); *new = "DUMP_RUN_CFG"; break; case 'M': ap_run_mode = AP_SQ_RM_CONFIG_DUMP; - new = (char **)apr_array_push(ap_server_config_defines); + new = (const char **)apr_array_push(ap_server_config_defines); *new = "DUMP_MODULES"; break; |