Commit e6088fa3 authored by Christophe Jaillet's avatar Christophe Jaillet
Browse files

apr_pcalloc can be turned into apr_palloc (the allocated memory is fully...

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
parent ea3f9470
Loading
Loading
Loading
Loading
+2 −2
Changes for modules/http2/h2_proxy_util.c: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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;
    }