]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Avoid some memory allocations by using apr_table_setn where the string
authorStefan Fritsch <sf@apache.org>
Mon, 13 Jun 2011 10:58:10 +0000 (10:58 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 13 Jun 2011 10:58:10 +0000 (10:58 +0000)
arguments are const.

Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 51357

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

modules/arch/netware/mod_netware.c
modules/arch/netware/mod_nw_ssl.c
modules/cache/cache_util.c
modules/http/http_filters.c
modules/proxy/proxy_util.c
modules/ssl/ssl_engine_io.c

index 76954cf6fb8f2fc330a99871b9ab53db73fa5f77..ad497292dee0d85bdfbaeb1091fdafdf3f20858b 100644 (file)
@@ -51,7 +51,7 @@ static void *create_netware_dir_config(apr_pool_t *p, char *dir)
     new->file_handler_mode = apr_table_make(p, 10);
     new->extra_env_vars = apr_table_make(p, 10);
 
-    apr_table_set(new->file_type_handlers, "NLM", "OS");
+    apr_table_setn(new->file_type_handlers, "NLM", "OS");
 
     return new;
 }
index 2750a17d766fbfe1d28edb38bef5c9a2fe221550..bc7665617a9619a5b4e67c51ac7d6cbfac24a17a 100644 (file)
@@ -895,7 +895,7 @@ static int nwssl_hook_Fixup(request_rec *r)
     if (!isSecure(r) && !isSecureUpgraded(r))
         return DECLINED;
 
-    apr_table_set(r->subprocess_env, "HTTPS", "on");
+    apr_table_setn(r->subprocess_env, "HTTPS", "on");
 
     return DECLINED;
 }
@@ -918,7 +918,7 @@ static apr_port_t nwssl_hook_default_port(const request_rec *r)
 
 int ssl_proxy_enable(conn_rec *c)
 {
-    apr_table_set(c->notes, "nwconv-ssl", "Y");
+    apr_table_setn(c->notes, "nwconv-ssl", "Y");
 
     return 1;
 }
index d359f0a8d4f07a7c364b16411b137aef2bbe8a7e..a735cef274d995676e76c415957af1a1d7a88cba 100644 (file)
@@ -644,8 +644,8 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
             /* make sure we don't stomp on a previous warning */
             if ((warn_head == NULL) ||
                 ((warn_head != NULL) && (ap_strstr_c(warn_head, "110") == NULL))) {
-                apr_table_merge(h->resp_hdrs, "Warning",
-                                "110 Response is stale");
+                apr_table_mergen(h->resp_hdrs, "Warning",
+                                 "110 Response is stale");
             }
         }
 
@@ -663,8 +663,8 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
              */
             if ((warn_head == NULL) ||
                 ((warn_head != NULL) && (ap_strstr_c(warn_head, "113") == NULL))) {
-                apr_table_merge(h->resp_hdrs, "Warning",
-                                "113 Heuristic expiration");
+                apr_table_mergen(h->resp_hdrs, "Warning",
+                                 "113 Heuristic expiration");
             }
         }
         return 1;    /* Cache object is fresh (enough) */
@@ -720,8 +720,8 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
         warn_head = apr_table_get(h->resp_hdrs, "Warning");
         if ((warn_head == NULL) ||
             ((warn_head != NULL) && (ap_strstr_c(warn_head, "110") == NULL))) {
-            apr_table_merge(h->resp_hdrs, "Warning",
-                        "110 Response is stale");
+            apr_table_mergen(h->resp_hdrs, "Warning",
+                             "110 Response is stale");
         }
 
         return 1;
index d4aa068605d024c8de982a7055c9377cfbeeca1c..a42a3bb16d892d727c9bdd32698de5f2ef151209 100644 (file)
@@ -1211,7 +1211,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
     if (apr_table_get(r->subprocess_env, "force-no-vary") != NULL) {
         apr_table_unset(r->headers_out, "Vary");
         r->proto_num = HTTP_VERSION(1,0);
-        apr_table_set(r->subprocess_env, "force-response-1.0", "1");
+        apr_table_setn(r->subprocess_env, "force-response-1.0", "1");
     }
     else {
         fixup_vary(r);
index e79d84bfdb6a6c33cd9ce9d1f0a1ea6eedd7b30d..27d774cbe80ac8a22fe07972935902f7f16d8654 100644 (file)
@@ -2008,7 +2008,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
                  * ensure that mod_proxy_http does the correct thing
                  * regarding the Connection header in the request.
                  */
-                apr_table_set(r->subprocess_env, "proxy-nokeepalive", "1");
+                apr_table_setn(r->subprocess_env, "proxy-nokeepalive", "1");
             }
         }
         else if (r->proxyreq == PROXYREQ_REVERSE) {
@@ -2024,7 +2024,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
                  * ensure that mod_proxy_http does the correct thing
                  * regarding the Connection header in the request.
                  */
-                apr_table_set(r->subprocess_env, "proxy-nokeepalive", "1");
+                apr_table_setn(r->subprocess_env, "proxy-nokeepalive", "1");
             }
         }
     }
index 4693ea4308d1e9cee53623c913b8f58435a9bcaf..bb2933a15cfa6b46bcda43ef241b174f3f4c1242 100644 (file)
@@ -1053,7 +1053,7 @@ static apr_status_t ssl_io_filter_handshake(ssl_filter_ctx_t *filter_ctx)
             ssl_log_ssl_error(SSLLOG_MARK, APLOG_INFO, server);
             /* ensure that the SSL structures etc are freed, etc: */
             ssl_filter_io_shutdown(filter_ctx, c, 1);
-            apr_table_set(c->notes, "SSL_connect_rv", "err");
+            apr_table_setn(c->notes, "SSL_connect_rv", "err");
             return MODSSL_ERROR_BAD_GATEWAY;
         }
 
@@ -1071,7 +1071,7 @@ static apr_status_t ssl_io_filter_handshake(ssl_filter_ctx_t *filter_ctx)
                 }
                 /* ensure that the SSL structures etc are freed, etc: */
                 ssl_filter_io_shutdown(filter_ctx, c, 1);
-                apr_table_set(c->notes, "SSL_connect_rv", "err");
+                apr_table_setn(c->notes, "SSL_connect_rv", "err");
                 return HTTP_BAD_GATEWAY;
             }
             X509_free(cert);
@@ -1091,12 +1091,12 @@ static apr_status_t ssl_io_filter_handshake(ssl_filter_ctx_t *filter_ctx)
                               hostname, hostname_note);
                 /* ensure that the SSL structures etc are freed, etc: */
                 ssl_filter_io_shutdown(filter_ctx, c, 1);
-                apr_table_set(c->notes, "SSL_connect_rv", "err");
+                apr_table_setn(c->notes, "SSL_connect_rv", "err");
                 return HTTP_BAD_GATEWAY;
             }
         }
 
-        apr_table_set(c->notes, "SSL_connect_rv", "ok");
+        apr_table_setn(c->notes, "SSL_connect_rv", "ok");
         return APR_SUCCESS;
     }