summaryrefslogtreecommitdiffstats
path: root/modules/http2
diff options
context:
space:
mode:
authorChristophe Jaillet <jailletc36@apache.org>2018-06-12 19:13:27 +0200
committerChristophe Jaillet <jailletc36@apache.org>2018-06-12 19:13:27 +0200
commita9848164c870e1aaa3598081d1e8e07e8556fa11 (patch)
treea1490f4b608c74c79f2e8ad156f194b8c1075002 /modules/http2
parentFollow up to r1833368: fix "mixed declarations and code" warning (buildbot). (diff)
downloadapache2-a9848164c870e1aaa3598081d1e8e07e8556fa11.tar.xz
apache2-a9848164c870e1aaa3598081d1e8e07e8556fa11.zip
apr_pcalloc can be turned into apr_palloc (the allocated memory is fully initialized by the subsequent memcpy/strcpy) and '(int)strlen(p)' can be replaced by 'plen - 1' to save some cycles.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1833415 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--modules/http2/h2_proxy_util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/http2/h2_proxy_util.c b/modules/http2/h2_proxy_util.c
index bd45294e1a..3cbf4d0b4b 100644
--- a/modules/http2/h2_proxy_util.c
+++ b/modules/http2/h2_proxy_util.c
@@ -915,12 +915,12 @@ static size_t subst_str(link_ctx *ctx, int start, int end, const char *ns)
nlen = (int)strlen(ns);
delta = nlen - olen;
plen = ctx->slen + delta + 1;
- p = apr_pcalloc(ctx->pool, plen);
+ p = apr_palloc(ctx->pool, plen);
memcpy(p, ctx->s, start);
memcpy(p + start, ns, nlen);
strcpy(p + start + nlen, ctx->s + end);
ctx->s = p;
- ctx->slen = (int)strlen(p);
+ ctx->slen = plen - 1; /* (int)strlen(p) */
if (ctx->i >= end) {
ctx->i += delta;
}