From 1b6e2b3ebf7d0b7176924d735efe9027522f42e8 Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Sat, 1 Feb 2014 08:26:33 +0000 Subject: [PATCH] s/apr_pstrndup/apr_pstrmemdup/ when applicable git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1563381 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cache/cache_storage.c | 2 +- server/util.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/cache/cache_storage.c b/modules/cache/cache_storage.c index 782dc712fc..234eb9bb74 100644 --- a/modules/cache/cache_storage.c +++ b/modules/cache/cache_storage.c @@ -582,7 +582,7 @@ static apr_status_t cache_canonicalise_key(request_rec *r, apr_pool_t* p, && !strncmp(param + 1, *identifier, len) && (*(param + len + 1) == '=') && !ap_strchr_c(param + len + 2, '/')) { - path = apr_pstrndup(p, path, param - path); + path = apr_pstrmemdup(p, path, param - path); continue; } /* diff --git a/server/util.c b/server/util.c index 5ceb9a8df3..ad465845c1 100644 --- a/server/util.c +++ b/server/util.c @@ -116,7 +116,7 @@ AP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype) while ((semi > intype) && apr_isspace(semi[-1])) { semi--; } - return apr_pstrndup(p, intype, semi - intype); + return apr_pstrmemdup(p, intype, semi - intype); } } @@ -737,7 +737,7 @@ AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *atrans, const char **line, return res; } - res = apr_pstrndup(atrans, *line, pos - *line); + res = apr_pstrmemdup(atrans, *line, pos - *line); ++pos; @@ -1464,7 +1464,6 @@ AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, const char *ptr = *accept_line; const char *tok_start; char *token; - int tok_len; /* Find first non-white byte */ @@ -1485,8 +1484,7 @@ AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, break; } - tok_len = ptr - tok_start; - token = apr_pstrndup(p, tok_start, tok_len); + token = apr_pstrmemdup(p, tok_start, ptr - tok_start); /* Advance accept_line pointer to the next non-white byte */ -- 2.40.0