]> granicus.if.org Git - apache/commitdiff
replacing strchr on const char * by proper ap_ variants
authorStefan Eissing <icing@apache.org>
Wed, 19 Aug 2015 14:55:26 +0000 (14:55 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 19 Aug 2015 14:55:26 +0000 (14:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1696607 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_alt_svc.c
modules/http2/h2_config.c
modules/http2/h2_request.c
modules/http2/h2_response.c

index ab1d726484ddddc1133725e08803ed6d4ed1f0f3..d18ae5f20de42a9fc1287b7ae83a881d19c20a3c 100644 (file)
@@ -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);
index 8bb267ec6f58814049a0e8da30726cbe713e0922..4317978d530645d0b0211fd54b8ea97a2fb3111c 100644 (file)
@@ -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, ", ");
index 83fa08560003dfcff65e07c06d31afbca8793fbe..ca9a362cb56612ff56342a2924090ab4b678bb23 100644 (file)
@@ -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);
     }
index 01b48203a619d4b9c121e01f02f745bddb86da28..00c0e945384b48979cf66f93affea2f8423e2e0a 100644 (file)
@@ -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'",