diff options
author | Takashi Sato <takashi@apache.org> | 2008-12-16 01:08:01 +0100 |
---|---|---|
committer | Takashi Sato <takashi@apache.org> | 2008-12-16 01:08:01 +0100 |
commit | 4975fd3583b510f5962f215156c3c73756f570c8 (patch) | |
tree | 359203fb6775bae8f5b1c07d72b6b78ceaf134fb | |
parent | core.xml: Clarify the Location and LocationMatch directive doc to emphasize (diff) | |
download | apache2-4975fd3583b510f5962f215156c3c73756f570c8.tar.xz apache2-4975fd3583b510f5962f215156c3c73756f570c8.zip |
* Change some "apr_palloc / memcpy" to apr_pstrmemdup
PR: 39519
Submitted by: Christophe JAILLET <christophe.jaillet wanadoo.fr>
* Remove unnecessary casts
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@726884 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | server/util.c | 13 | ||||
-rw-r--r-- | support/ab.c | 4 |
2 files changed, 5 insertions, 12 deletions
diff --git a/server/util.c b/server/util.c index 3651e05931..795cbcb2d2 100644 --- a/server/util.c +++ b/server/util.c @@ -578,9 +578,8 @@ AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s) return apr_pstrdup(p, ""); } l = (last_slash - s) + 1; - d = apr_palloc(p, l + 1); - memcpy(d, s, l); - d[l] = 0; + d = apr_pstrmemdup(p, s, l); + return (d); } @@ -611,9 +610,7 @@ AP_DECLARE(char *) ap_getword(apr_pool_t *atrans, const char **line, char stop) } len = pos - *line; - res = (char *)apr_palloc(atrans, len + 1); - memcpy(res, *line, len); - res[len] = 0; + res = apr_pstrmemdup(atrans, *line, len); if (stop) { while (*pos == stop) { @@ -641,9 +638,7 @@ AP_DECLARE(char *) ap_getword_white(apr_pool_t *atrans, const char **line) } len = pos - *line; - res = (char *)apr_palloc(atrans, len + 1); - memcpy(res, *line, len); - res[len] = 0; + res = apr_pstrmemdup(atrans, *line, len); while (apr_isspace(*pos)) { ++pos; diff --git a/support/ab.c b/support/ab.c index 95b48a4fc0..4a35903228 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1892,9 +1892,7 @@ static int parse_url(char *url) if ((cp = strchr(url, '/')) == NULL) return 1; - h = apr_palloc(cntxt, cp - url + 1); - memcpy(h, url, cp - url); - h[cp - url] = '\0'; + h = apr_pstrmemdup(cntxt, url, cp - url); rv = apr_parse_addr_port(&hostname, &scope_id, &port, h, cntxt); if (rv != APR_SUCCESS || !hostname || scope_id) { return 1; |