From: Stefan Fritsch Date: Fri, 21 Jan 2011 09:03:52 +0000 (+0000) Subject: Make ap_pstr2_alnum accept const char dest X-Git-Tag: 2.3.11~152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e108fd44fabde751fdd7dd566d8d5e14504f849;p=apache Make ap_pstr2_alnum accept const char dest git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1061695 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/httpd.h b/include/httpd.h index 146f3b9756..224b38afae 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1839,7 +1839,8 @@ AP_DECLARE(int) ap_request_has_body(request_rec *r); * @param dest cleaned up, allocated string * @return Status value indicating whether the cleaning was successful or not. */ -AP_DECLARE(apr_status_t) ap_pstr2_alnum(apr_pool_t *p, const char *src, char **dest); +AP_DECLARE(apr_status_t) ap_pstr2_alnum(apr_pool_t *p, const char *src, + const char **dest); /** * Cleanup a string (mainly to be filesystem safe) diff --git a/server/util.c b/server/util.c index 1911616dac..b61aa8eb80 100644 --- a/server/util.c +++ b/server/util.c @@ -2183,10 +2183,12 @@ AP_DECLARE(apr_status_t) ap_str2_alnum(const char *src, char *dest) { } -AP_DECLARE(apr_status_t) ap_pstr2_alnum(apr_pool_t *p, const char *src, char **dest) +AP_DECLARE(apr_status_t) ap_pstr2_alnum(apr_pool_t *p, const char *src, + const char **dest) { - *dest = apr_palloc(p, strlen(src)+1); - if (!*dest) + char *new = apr_palloc(p, strlen(src)+1); + if (!new) return APR_ENOMEM; - return ap_str2_alnum(src, *dest); + *dest = new; + return ap_str2_alnum(src, new); }