]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Constify static arrays of string constants.
authorJoe Orton <jorton@apache.org>
Fri, 1 May 2026 14:48:59 +0000 (14:48 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 1 May 2026 14:48:59 +0000 (14:48 +0000)
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>
Github: closes #643

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933659 13f79535-47bb-0310-9956-ffa450edef68

13 files changed:
modules/cache/mod_cache.c
modules/filters/mod_proxy_html.c
modules/http2/h2_protocol.c
modules/http2/h2_proxy_session.c
modules/http2/h2_session.c
modules/loggers/mod_logio.c
modules/mappers/mod_speling.c
modules/md/md_log.c
modules/md/md_store.c
modules/proxy/ajp_header.c
modules/proxy/mod_proxy_http.c
modules/ssl/mod_ssl.c
server/protocol.c

index cb59aae9928191efe2200c311704acb414772123..37c06e9472710f8eda0505a1aa88b9708682aa73 100644 (file)
@@ -39,7 +39,7 @@ static ap_filter_rec_t *cache_invalidate_filter_handle;
 /**
  * Entity headers' names
  */
-static const char *MOD_CACHE_ENTITY_HEADERS[] = {
+static const char *const MOD_CACHE_ENTITY_HEADERS[] = {
     "Allow",
     "Content-Encoding",
     "Content-Language",
@@ -819,7 +819,7 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
     apr_time_t exp, date, lastmod, now;
     apr_off_t size = -1;
     cache_info *info = NULL;
-    const char *reason, **eh;
+    const char *reason, *const *eh;
     apr_pool_t *p;
     apr_bucket *e;
     apr_table_t *headers;
index b423ca67bf2c2ad8d3be16a7be434d13b514dc53..f64bafceb2e41ff3d3e6cf3be8dc119b9ddd5588 100644 (file)
@@ -1393,7 +1393,7 @@ static void proxy_html_insert(request_rec *r)
 }
 static void proxy_html_hooks(apr_pool_t *p)
 {
-    static const char *aszSucc[] = { "mod_filter.c", NULL };
+    static const char *const aszSucc[] = { "mod_filter.c", NULL };
     ap_register_output_filter_protocol("proxy-html", proxy_html_filter,
                                        NULL, AP_FTYPE_RESOURCE,
                           AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH);
index 874753e4983e1aba8326136574e4d98b6b11222f..84a17ef8948d1d00c0a9d5299a7e8c3bca6d00a6 100644 (file)
@@ -58,7 +58,7 @@ const char *H2_MAGIC_TOKEN = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
 /*******************************************************************************
  * HTTP/2 error stuff
  */
-static const char *h2_err_descr[] = {
+static const char *const h2_err_descr[] = {
     "no error",                    /* 0x0 */
     "protocol error",
     "internal error",
@@ -91,7 +91,7 @@ const char *h2_protocol_err_description(unsigned int h2_error)
  * Black Listed Ciphers from RFC 7549 Appendix A
  *
  */
-static const char *RFC7540_names[] = {
+static const char *const RFC7540_names[] = {
     /* ciphers with NULL encrpytion */
     "NULL-MD5",                         /* TLS_NULL_WITH_NULL_NULL */
     /* same */                          /* TLS_RSA_WITH_NULL_MD5 */
index 3561c241e1beef7614db07a0ad4d084332f8879d..166b6468f1da9cae6e0b865757c862052b352ec3 100644 (file)
@@ -1188,7 +1188,7 @@ static apr_status_t session_shutdown(h2_proxy_session *session, int reason,
 }
 
 
-static const char *StateNames[] = {
+static const char *const StateNames[] = {
     "INIT",      /* H2_PROXYS_ST_INIT */
     "DONE",      /* H2_PROXYS_ST_DONE */
     "IDLE",      /* H2_PROXYS_ST_IDLE */
index dda6c77178b89437bb89ca97525ced273bcdf090..3affaf2a206b61adc3401c66a910dac1d5aa6810 100644 (file)
@@ -1416,7 +1416,7 @@ static void on_stream_output(void *ctx, h2_stream *stream)
 }
 
 
-static const char *StateNames[] = {
+static const char *const StateNames[] = {
     "INIT",      /* H2_SESSION_ST_INIT */
     "DONE",      /* H2_SESSION_ST_DONE */
     "IDLE",      /* H2_SESSION_ST_IDLE */
index bf98ccb84c456d2734f610214aee26a83e81022f..b2e98d1fe0676cc0e73d6cf2118d75d4530166ed 100644 (file)
@@ -333,7 +333,7 @@ static const command_rec logio_cmds[] = {
 
 static void register_hooks(apr_pool_t *p)
 {
-    static const char *pre[] = { "mod_log_config.c", NULL };
+    static const char *const pre[] = { "mod_log_config.c", NULL };
 
     ap_hook_pre_connection(logio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_pre_config(logio_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
index 2ed65eb81015265cfb58e04ba9fdfe417c367d42..99b8765416aa0718f57fe1a2313500a46056046c 100644 (file)
@@ -125,7 +125,7 @@ typedef enum {
     SP_VERYDIFFERENT = 6
 } sp_reason;
 
-static const char *sp_reason_str[] =
+static const char *const sp_reason_str[] =
 {
     "identical",
     "miscapitalized",
index d236e0f08825e13f1850ace0091ae2cbc2b74e77..1b85b3db1663216aa9da5530ac3121cd5f877553 100644 (file)
@@ -22,7 +22,7 @@
 
 #define LOG_BUFFER_LEN  1024
 
-static const char *level_names[] = {
+static const char *const level_names[] = {
     "emergency",
     "alert",
     "crit",
index 5ed0848f991c0df3946862cd8ee7db11d6b610c2..381bbbc4a2f5a3370834168e4256314fa4a5bb82 100644 (file)
@@ -47,7 +47,7 @@
 #define GNAME_STAGING      
 #define GNAME_ARCHIVE      
 
-static const char *GROUP_NAME[] = {
+static const char *const GROUP_NAME[] = {
     "none",
     "accounts",
     "challenges",
index 334d0aebb12b4b6bdd57cb5f48b4a098712f8484..af2f27b24153e63e1e56a086b08aa56599c46666 100644 (file)
@@ -21,7 +21,7 @@
 
 APLOG_USE_MODULE(proxy_ajp);
 
-static const char *response_trans_headers[] = {
+static const char *const response_trans_headers[] = {
     "Content-Type",
     "Content-Language",
     "Content-Length",
index bfeee8685583d142eb881862749f28338e343e49..98387d62b3f43d1b7c1591de90bba49e576e3cf5 100644 (file)
@@ -820,7 +820,7 @@ static request_rec *make_fake_req(conn_rec *c, request_rec *r)
 static void process_proxy_header(request_rec *r, proxy_dir_conf *c,
                                  const char *key, const char *value)
 {
-    static const char *date_hdrs[]
+    static const char *const date_hdrs[]
         = { "Date", "Expires", "Last-Modified", NULL };
     static const struct {
         const char *name;
@@ -1086,7 +1086,7 @@ int ap_proxy_http_process_response(proxy_http_req_t *req)
     int pread_len = 0;
     apr_table_t *save_table;
     int backend_broke = 0;
-    static const char *hop_by_hop_hdrs[] =
+    static const char *const hop_by_hop_hdrs[] =
         {"Keep-Alive", "Proxy-Authenticate", "TE", "Trailer", "Upgrade", NULL};
     int i;
     const char *te = NULL;
index 6f89b1a0258eb0e6016882741f499b766fe6f637..8f79d0a8bc077b24e933d23006a4ee5cc277bdb4 100644 (file)
@@ -747,12 +747,12 @@ static void ssl_register_hooks(apr_pool_t *p)
 {
     /* ssl_hook_ReadReq needs to use the BrowserMatch settings so must
      * run after mod_setenvif's post_read_request hook. */
-    static const char *pre_prr[] = { "mod_setenvif.c", NULL };
+    static const char *const pre_prr[] = { "mod_setenvif.c", NULL };
     /* The ssl_init_Module post_config hook should run before mod_proxy's
      * for the ssl proxy main configs to be merged with vhosts' before being
      * themselves merged with mod_proxy's in proxy_hook_section_post_config.
      */
-    static const char *b_pc[] = { "mod_proxy.c", NULL};
+    static const char *const b_pc[] = { "mod_proxy.c", NULL};
 
 
     ssl_io_filter_register(p);
index 9ac4e3fe929f6f41b7a6e2dc2d865fceb02fe33e..b739d6913beacd97a69d2cecf44ca7a666bceffa 100644 (file)
@@ -77,7 +77,7 @@ AP_DECLARE_DATA ap_filter_rec_t *ap_old_write_func = NULL;
 
 
 /* Patterns to match in ap_make_content_type() */
-static const char *needcset[] = {
+static const char *const needcset[] = {
     "text/plain",
     "text/html",
     NULL