Skip to content

Commit 4880300

Browse files
notrojclaude
andcommitted
Constify static arrays of string constants.
Add const qualifier to the pointer in static arrays of string constants (const char *[] -> const char *const []) across various modules and server code, and adjust a local variable type in mod_cache accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ce80562 commit 4880300

13 files changed

Lines changed: 17 additions & 17 deletions

File tree

modules/cache/mod_cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static ap_filter_rec_t *cache_invalidate_filter_handle;
3939
/**
4040
* Entity headers' names
4141
*/
42-
static const char *MOD_CACHE_ENTITY_HEADERS[] = {
42+
static const char *const MOD_CACHE_ENTITY_HEADERS[] = {
4343
"Allow",
4444
"Content-Encoding",
4545
"Content-Language",
@@ -819,7 +819,7 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
819819
apr_time_t exp, date, lastmod, now;
820820
apr_off_t size = -1;
821821
cache_info *info = NULL;
822-
const char *reason, **eh;
822+
const char *reason, *const *eh;
823823
apr_pool_t *p;
824824
apr_bucket *e;
825825
apr_table_t *headers;

modules/filters/mod_proxy_html.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ static void proxy_html_insert(request_rec *r)
13931393
}
13941394
static void proxy_html_hooks(apr_pool_t *p)
13951395
{
1396-
static const char *aszSucc[] = { "mod_filter.c", NULL };
1396+
static const char *const aszSucc[] = { "mod_filter.c", NULL };
13971397
ap_register_output_filter_protocol("proxy-html", proxy_html_filter,
13981398
NULL, AP_FTYPE_RESOURCE,
13991399
AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH);

modules/http2/h2_protocol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const char *H2_MAGIC_TOKEN = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
5858
/*******************************************************************************
5959
* HTTP/2 error stuff
6060
*/
61-
static const char *h2_err_descr[] = {
61+
static const char *const h2_err_descr[] = {
6262
"no error", /* 0x0 */
6363
"protocol error",
6464
"internal error",
@@ -91,7 +91,7 @@ const char *h2_protocol_err_description(unsigned int h2_error)
9191
* Black Listed Ciphers from RFC 7549 Appendix A
9292
*
9393
*/
94-
static const char *RFC7540_names[] = {
94+
static const char *const RFC7540_names[] = {
9595
/* ciphers with NULL encrpytion */
9696
"NULL-MD5", /* TLS_NULL_WITH_NULL_NULL */
9797
/* same */ /* TLS_RSA_WITH_NULL_MD5 */

modules/http2/h2_proxy_session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ static apr_status_t session_shutdown(h2_proxy_session *session, int reason,
11881188
}
11891189

11901190

1191-
static const char *StateNames[] = {
1191+
static const char *const StateNames[] = {
11921192
"INIT", /* H2_PROXYS_ST_INIT */
11931193
"DONE", /* H2_PROXYS_ST_DONE */
11941194
"IDLE", /* H2_PROXYS_ST_IDLE */

modules/http2/h2_session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ static void on_stream_output(void *ctx, h2_stream *stream)
14161416
}
14171417

14181418

1419-
static const char *StateNames[] = {
1419+
static const char *const StateNames[] = {
14201420
"INIT", /* H2_SESSION_ST_INIT */
14211421
"DONE", /* H2_SESSION_ST_DONE */
14221422
"IDLE", /* H2_SESSION_ST_IDLE */

modules/loggers/mod_logio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static const command_rec logio_cmds[] = {
333333

334334
static void register_hooks(apr_pool_t *p)
335335
{
336-
static const char *pre[] = { "mod_log_config.c", NULL };
336+
static const char *const pre[] = { "mod_log_config.c", NULL };
337337

338338
ap_hook_pre_connection(logio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
339339
ap_hook_pre_config(logio_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);

modules/mappers/mod_speling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ typedef enum {
125125
SP_VERYDIFFERENT = 6
126126
} sp_reason;
127127

128-
static const char *sp_reason_str[] =
128+
static const char *const sp_reason_str[] =
129129
{
130130
"identical",
131131
"miscapitalized",

modules/md/md_log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#define LOG_BUFFER_LEN 1024
2424

25-
static const char *level_names[] = {
25+
static const char *const level_names[] = {
2626
"emergency",
2727
"alert",
2828
"crit",

modules/md/md_store.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#define GNAME_STAGING
4848
#define GNAME_ARCHIVE
4949

50-
static const char *GROUP_NAME[] = {
50+
static const char *const GROUP_NAME[] = {
5151
"none",
5252
"accounts",
5353
"challenges",

modules/proxy/ajp_header.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
APLOG_USE_MODULE(proxy_ajp);
2323

24-
static const char *response_trans_headers[] = {
24+
static const char *const response_trans_headers[] = {
2525
"Content-Type",
2626
"Content-Language",
2727
"Content-Length",

0 commit comments

Comments
 (0)