You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2020/05/04 10:48:55 UTC

svn commit: r1877350 - /httpd/httpd/trunk/server/util_expr_eval.c

Author: jorton
Date: Mon May  4 10:48:55 2020
New Revision: 1877350

URL: http://svn.apache.org/viewvc?rev=1877350&view=rev
Log:
Constify pointers in ap_expr lookup tables, as well as the already
const pointed-to strings.  ~1/2Kb moves to r/o text section, size(1)
diff:

    text           data     bss     dec     hex filename
- 667519          18384   13952  699855   aadcf httpd
+ 668015          17864   13952  699831   aadb7 httpd

* server/util_expr_eval.c
  [*_var_names, expr_provider_multi]: Mark pointers in name
  lists as const.
  (core_expr_lookup): Adjust accordingly.

Modified:
    httpd/httpd/trunk/server/util_expr_eval.c

Modified: httpd/httpd/trunk/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_eval.c?rev=1877350&r1=1877349&r2=1877350&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_expr_eval.c (original)
+++ httpd/httpd/trunk/server/util_expr_eval.c Mon May  4 10:48:55 2020
@@ -1634,7 +1634,7 @@ static APR_OPTIONAL_FN_TYPE(ssl_is_https
 APR_DECLARE_OPTIONAL_FN(int, http2_is_h2, (conn_rec *));
 static APR_OPTIONAL_FN_TYPE(http2_is_h2) *is_http2 = NULL;
 
-static const char *conn_var_names[] = {
+static const char *const conn_var_names[] = {
     "HTTPS",                    /*  0 */
     "IPV6",                     /*  1 */
     "CONN_LOG_ID",              /*  2 */
@@ -1684,7 +1684,7 @@ static const char *conn_var_fn(ap_expr_e
     }
 }
 
-static const char *request_var_names[] = {
+static const char *const request_var_names[] = {
     "REQUEST_METHOD",           /*  0 */
     "REQUEST_SCHEME",           /*  1 */
     "REQUEST_URI",              /*  2 */
@@ -1835,7 +1835,7 @@ static const char *request_var_fn(ap_exp
     }
 }
 
-static const char *req_header_var_names[] = {
+static const char *const req_header_var_names[] = {
     "HTTP_USER_AGENT",       /* 0 */
     "HTTP_PROXY_CONNECTION", /* 1 */
     "HTTP_REFERER",          /* 2 */
@@ -1846,7 +1846,7 @@ static const char *req_header_var_names[
     NULL
 };
 
-static const char *req_header_header_names[] = {
+static const char *const req_header_header_names[] = {
     "User-Agent",
     "Proxy-Connection",
     "Referer",
@@ -1858,7 +1858,7 @@ static const char *req_header_header_nam
 
 static const char *req_header_var_fn(ap_expr_eval_ctx_t *ctx, const void *data)
 {
-    const char **varname = (const char **)data;
+    const char **const varname = (const char **)data;
     int index = (varname - req_header_var_names);
     const char *name;
 
@@ -1876,7 +1876,7 @@ static const char *req_header_var_fn(ap_
     return apr_table_get(ctx->r->headers_in, name);
 }
 
-static const char *misc_var_names[] = {
+static const char *const misc_var_names[] = {
     "TIME_YEAR",        /* 0 */
     "TIME_MON",         /* 1 */
     "TIME_DAY",         /* 2 */
@@ -2033,7 +2033,7 @@ struct expr_provider_single {
 
 struct expr_provider_multi {
     const void *func;
-    const char **names;
+    const char *const *names;
 };
 
 static const struct expr_provider_multi var_providers[] = {
@@ -2104,7 +2104,7 @@ static int core_expr_lookup(ap_expr_look
     case AP_EXPR_FUNC_VAR: {
             const struct expr_provider_multi *prov = var_providers;
             while (prov->func) {
-                const char **name = prov->names;
+                const char *const *name = prov->names;
                 while (*name) {
                     if (ap_cstr_casecmp(*name, parms->name) == 0) {
                         *parms->func = prov->func;