From: Stefan Eissing Date: Wed, 19 Aug 2015 14:55:26 +0000 (+0000) Subject: replacing strchr on const char * by proper ap_ variants X-Git-Tag: 2.5.0-alpha~2943 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c5662ff2be8abb3339ab562863426f88621ade7;p=apache replacing strchr on const char * by proper ap_ variants git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1696607 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_alt_svc.c b/modules/http2/h2_alt_svc.c index ab1d726484..d18ae5f20d 100644 --- a/modules/http2/h2_alt_svc.c +++ b/modules/http2/h2_alt_svc.c @@ -42,13 +42,13 @@ void h2_alt_svc_register_hooks(void) * - do not use quotation marks */ h2_alt_svc *h2_alt_svc_parse(const char *s, apr_pool_t *pool) { - const char *sep = strchr((char *)s, '='); + const char *sep = ap_strchr_c(s, '='); if (sep) { const char *alpn = apr_pstrndup(pool, s, sep - s); const char *host = NULL; int port = 0; s = sep + 1; - sep = strchr((char *)s, ':'); /* mandatory : */ + sep = ap_strchr_c(s, ':'); /* mandatory : */ if (sep) { if (sep != s) { /* optional host */ host = apr_pstrndup(pool, s, sep - s); diff --git a/modules/http2/h2_config.c b/modules/http2/h2_config.c index 8bb267ec6f..4317978d53 100644 --- a/modules/http2/h2_config.c +++ b/modules/http2/h2_config.c @@ -58,7 +58,7 @@ static void *h2_config_create(apr_pool_t *pool, h2_config *conf = (h2_config *)apr_pcalloc(pool, sizeof(h2_config)); const char *s = x? x : "unknown"; - char *name = (char *)apr_pcalloc(pool, strlen(prefix) + strlen(s) + 20); + char *name = apr_pcalloc(pool, strlen(prefix) + strlen(s) + 20); strcpy(name, prefix); strcat(name, "["); strcat(name, s); @@ -97,8 +97,7 @@ void *h2_config_merge(apr_pool_t *pool, void *basev, void *addv) h2_config *add = (h2_config *)addv; h2_config *n = (h2_config *)apr_pcalloc(pool, sizeof(h2_config)); - char *name = (char *)apr_pcalloc(pool, - 20 + strlen(add->name) + strlen(base->name)); + char *name = apr_pcalloc(pool, 20 + strlen(add->name) + strlen(base->name)); strcpy(name, "merged["); strcat(name, add->name); strcat(name, ", "); diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c index 83fa085600..ca9a362cb5 100644 --- a/modules/http2/h2_request.c +++ b/modules/http2/h2_request.c @@ -58,7 +58,7 @@ apr_status_t h2_request_rwrite(h2_request *req, request_rec *r, h2_mplx *m) req->method = r->method; req->authority = r->hostname; req->path = r->uri; - if (!strchr((char *)req->authority, ':') && r->parsed_uri.port_str) { + if (!ap_strchr_c(req->authority, ':') && r->parsed_uri.port_str) { req->authority = apr_psprintf(req->pool, "%s:%s", req->authority, r->parsed_uri.port_str); } diff --git a/modules/http2/h2_response.c b/modules/http2/h2_response.c index 01b48203a6..00c0e94538 100644 --- a/modules/http2/h2_response.c +++ b/modules/http2/h2_response.c @@ -58,7 +58,7 @@ h2_response *h2_response_create(int stream_id, header = apr_table_make(pool, hlines->nelts); for (i = 0; i < hlines->nelts; ++i) { char *hline = ((char **)hlines->elts)[i]; - char *sep = strchr(hline, ':'); + char *sep = ap_strchr(hline, ':'); if (!sep) { ap_log_perror(APLOG_MARK, APLOG_WARNING, APR_EINVAL, pool, APLOGNO(02955) "h2_response(%d): invalid header[%d] '%s'",