You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by el...@apache.org on 2015/07/23 21:20:10 UTC

svn commit: r1692432 - in /httpd/httpd/trunk/modules/http2: h2_alpn.c h2_alt_svc.c h2_conn.c h2_conn_io.c h2_io_set.c h2_response.c h2_stream_set.c h2_util.c

Author: elu
Date: Thu Jul 23 19:20:09 2015
New Revision: 1692432

URL: http://svn.apache.org/r1692432
Log:
c89-ify http2

Modified:
    httpd/httpd/trunk/modules/http2/h2_alpn.c
    httpd/httpd/trunk/modules/http2/h2_alt_svc.c
    httpd/httpd/trunk/modules/http2/h2_conn.c
    httpd/httpd/trunk/modules/http2/h2_conn_io.c
    httpd/httpd/trunk/modules/http2/h2_io_set.c
    httpd/httpd/trunk/modules/http2/h2_response.c
    httpd/httpd/trunk/modules/http2/h2_stream_set.c
    httpd/httpd/trunk/modules/http2/h2_util.c

Modified: httpd/httpd/trunk/modules/http2/h2_alpn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_alpn.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_alpn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_alpn.c Thu Jul 23 19:20:09 2015
@@ -143,7 +143,8 @@ void h2_alpn_register_hooks(void)
 
 static int h2_util_array_index(apr_array_header_t *array, const char *s)
 {
-    for (int i = 0; i < array->nelts; i++) {
+    int i;
+    for (i = 0; i < array->nelts; i++) {
         const char *p = APR_ARRAY_IDX(array, i, const char*);
         if (!strcmp(p, s)) {
             return i;
@@ -155,6 +156,7 @@ static int h2_util_array_index(apr_array
 static int h2_npn_advertise(conn_rec *c, apr_array_header_t *protos)
 {
     h2_config *cfg;
+    apr_size_t i;
     
     check_sni_host(c);
     cfg = h2_config_get(c);
@@ -162,7 +164,7 @@ static int h2_npn_advertise(conn_rec *c,
         return DECLINED;
     }
     
-    for (apr_size_t i = 0; i < h2_alpn_protos_len; ++i) {
+    for (i = 0; i < h2_alpn_protos_len; ++i) {
         const char *proto = h2_alpn_protos[i];
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,
                       "NPN proposing %s from client selection", proto);
@@ -176,6 +178,7 @@ static int h2_negotiated(conn_rec *c, co
                          apr_size_t proto_name_len)
 {
     h2_ctx *ctx = h2_ctx_get(c);
+    apr_size_t i;
 
     if (h2_ctx_is_task(ctx) ) {
         return DECLINED;
@@ -197,7 +200,7 @@ static int h2_negotiated(conn_rec *c, co
                       apr_pstrndup(c->pool, proto_name, proto_name_len));
     }
     
-    for (apr_size_t i = 0; i < h2_alpn_protos_len; ++i) {
+    for (i = 0; i < h2_alpn_protos_len; ++i) {
         const char *proto = h2_alpn_protos[i];
         if (proto_name_len == strlen(proto)
             && strncmp(proto, proto_name, proto_name_len) == 0) {
@@ -222,6 +225,7 @@ static int h2_alpn_propose(conn_rec *c,
                            apr_array_header_t *protos)
 {
     h2_config *cfg;
+    apr_size_t i;
     
     check_sni_host(c);
     cfg = h2_config_get(c);
@@ -234,7 +238,7 @@ static int h2_alpn_propose(conn_rec *c,
     ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
                   "ALPN propose for config %s", cfg->name);
     /* */
-    for (apr_size_t i = 0; i < h2_alpn_protos_len; ++i) {
+    for (i = 0; i < h2_alpn_protos_len; ++i) {
         const char *proto = h2_alpn_protos[i];
         if (h2_util_array_index(client_protos, proto) >= 0) {
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,

Modified: httpd/httpd/trunk/modules/http2/h2_alt_svc.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_alt_svc.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_alt_svc.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_alt_svc.c Thu Jul 23 19:20:09 2015
@@ -73,6 +73,7 @@ static int h2_alt_svc_request_handler(re
 {
     h2_ctx *ctx = h2_ctx_rget(r);
     h2_config *cfg;
+    int i;
     
     if (h2_ctx_is_active(ctx) || h2_ctx_is_task(ctx)) {
         return DECLINED;
@@ -98,7 +99,7 @@ static int h2_alt_svc_request_handler(re
                           "h2_alt_svc: announce %s for %s:%d", 
                           (secure? "secure" : "insecure"), 
                           r->hostname, (int)r->server->port);
-            for (int i = 0; i < cfg->alt_svcs->nelts; ++i) {
+            for (i = 0; i < cfg->alt_svcs->nelts; ++i) {
                 h2_alt_svc *as = h2_alt_svc_IDX(cfg->alt_svcs, i);
                 const char *ahost = as->host;
                 if (ahost && !apr_strnatcasecmp(ahost, r->hostname)) {

Modified: httpd/httpd/trunk/modules/http2/h2_conn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.c Thu Jul 23 19:20:09 2015
@@ -48,8 +48,9 @@ static int checked;
 
 static void check_modules() 
 {
+    int i;
     if (!checked) {
-        for (int i = 0; ap_loaded_modules[i]; ++i) {
+        for (i = 0; ap_loaded_modules[i]; ++i) {
             module *m = ap_loaded_modules[i];
             if (!strcmp("event.c", m->name)) {
                 mpm_type = H2_MPM_EVENT;
@@ -81,6 +82,7 @@ apr_status_t h2_conn_child_init(apr_pool
     int max_threads_per_child = 0;
     int threads_limit = 0;
     int idle_secs = 0;
+    int i;
 
     ap_mpm_query(AP_MPMQ_MAX_THREADS, &max_threads_per_child);
     ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &threads_limit);
@@ -95,7 +97,7 @@ apr_status_t h2_conn_child_init(apr_pool
         }
     }
     
-    for (int i = 0; ap_loaded_modules[i]; ++i) {
+    for (i = 0; ap_loaded_modules[i]; ++i) {
         module *m = ap_loaded_modules[i];
         if (!strcmp("event.c", m->name)) {
             mpm_type = H2_MPM_EVENT;

Modified: httpd/httpd/trunk/modules/http2/h2_conn_io.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn_io.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn_io.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn_io.c Thu Jul 23 19:20:09 2015
@@ -188,8 +188,9 @@ static apr_status_t bucketeer_buffer(h2_
     apr_size_t remaining = io->buflen;
     int bcount = (int)(remaining / io->max_write_size);
     apr_bucket *b;
+    int i;
     
-    for (int i = 0; i < bcount; ++i) {
+    for (i = 0; i < bcount; ++i) {
         b = apr_bucket_transient_create(data, io->max_write_size, 
                                         io->output->bucket_alloc);
         APR_BRIGADE_INSERT_TAIL(io->output, b);

Modified: httpd/httpd/trunk/modules/http2/h2_io_set.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_io_set.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_io_set.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_io_set.c Thu Jul 23 19:20:09 2015
@@ -47,7 +47,8 @@ h2_io_set *h2_io_set_create(apr_pool_t *
 
 void h2_io_set_destroy(h2_io_set *sp)
 {
-    for (int i = 0; i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < sp->list->nelts; ++i) {
         h2_io *io = h2_io_IDX(sp->list, i);
         h2_io_destroy(io);
     }
@@ -76,7 +77,8 @@ h2_io *h2_io_set_get(h2_io_set *sp, int
 h2_io *h2_io_set_get_highest_prio(h2_io_set *set)
 {
     h2_io *highest = NULL;
-    for (int i = 0; i < set->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < set->list->nelts; ++i) {
         h2_io *io = h2_io_IDX(set->list, i);
         if (!highest /*|| io-prio even higher */ ) {
             highest = io;
@@ -114,7 +116,8 @@ apr_status_t h2_io_set_add(h2_io_set *sp
 
 h2_io *h2_io_set_remove(h2_io_set *sp, h2_io *io)
 {
-    for (int i = 0; i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < sp->list->nelts; ++i) {
         h2_io *e = h2_io_IDX(sp->list, i);
         if (e == io) {
             int n;
@@ -135,7 +138,8 @@ h2_io *h2_io_set_remove(h2_io_set *sp, h
 
 void h2_io_set_destroy_all(h2_io_set *sp)
 {
-    for (int i = 0; i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < sp->list->nelts; ++i) {
         h2_io *io = h2_io_IDX(sp->list, i);
         h2_io_destroy(io);
     }
@@ -156,7 +160,8 @@ int h2_io_set_is_empty(h2_io_set *sp)
 void h2_io_set_iter(h2_io_set *sp,
                         h2_io_set_iter_fn *iter, void *ctx)
 {
-    for (int i = 0; i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < sp->list->nelts; ++i) {
         h2_io *s = h2_io_IDX(sp->list, i);
         if (!iter(ctx, s)) {
             break;

Modified: httpd/httpd/trunk/modules/http2/h2_response.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_response.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_response.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_response.c Thu Jul 23 19:20:09 2015
@@ -46,6 +46,7 @@ h2_response *h2_response_create(int stre
 {
     apr_table_t *header;
     h2_response *response = apr_pcalloc(pool, sizeof(h2_response));
+    int i;
     if (response == NULL) {
         return NULL;
     }
@@ -55,7 +56,7 @@ h2_response *h2_response_create(int stre
     
     if (hlines) {
         header = apr_table_make(pool, hlines->nelts);        
-        for (int i = 0; i < hlines->nelts; ++i) {
+        for (i = 0; i < hlines->nelts; ++i) {
             char *hline = ((char **)hlines->elts)[i];
             char *sep = strchr(hline, ':');
             if (!sep) {

Modified: httpd/httpd/trunk/modules/http2/h2_stream_set.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_stream_set.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_stream_set.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_stream_set.c Thu Jul 23 19:20:09 2015
@@ -103,7 +103,8 @@ apr_status_t h2_stream_set_add(h2_stream
 
 h2_stream *h2_stream_set_remove(h2_stream_set *sp, h2_stream *stream)
 {
-    for (int i = 0; i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < sp->list->nelts; ++i) {
         h2_stream *s = H2_STREAM_IDX(sp->list, i);
         if (s == stream) {
             int n;
@@ -137,7 +138,8 @@ h2_stream *h2_stream_set_find(h2_stream_
                               h2_stream_set_match_fn match, void *ctx)
 {
     h2_stream *s = NULL;
-    for (int i = 0; !s && i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; !s && i < sp->list->nelts; ++i) {
         s = match(ctx, H2_STREAM_IDX(sp->list, i));
     }
     return s;
@@ -146,7 +148,8 @@ h2_stream *h2_stream_set_find(h2_stream_
 void h2_stream_set_iter(h2_stream_set *sp,
                         h2_stream_set_iter_fn *iter, void *ctx)
 {
-    for (int i = 0; i < sp->list->nelts; ++i) {
+    int i;
+    for (i = 0; i < sp->list->nelts; ++i) {
         h2_stream *s = H2_STREAM_IDX(sp->list, i);
         if (!iter(ctx, s)) {
             break;

Modified: httpd/httpd/trunk/modules/http2/h2_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_util.c?rev=1692432&r1=1692431&r2=1692432&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_util.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_util.c Thu Jul 23 19:20:09 2015
@@ -64,7 +64,8 @@ size_t h2_util_header_print(char *buffer
 
 char *h2_strlwr(char *s)
 {
-    for (char *p = s; *p; ++p) {
+    char *p;
+    for (p = s; *p; ++p) {
         if (*p >= 'A' && *p <= 'Z') {
             *p += 'a' - 'A';
         }
@@ -75,7 +76,8 @@ char *h2_strlwr(char *s)
 void h2_util_camel_case_header(char *s, size_t len)
 {
     size_t start = 1;
-    for (size_t i = 0; i < len; ++i) {
+    size_t i;
+    for (i = 0; i < len; ++i) {
         if (start) {
             if (s[i] >= 'a' && s[i] <= 'z') {
                 s[i] -= 'a' - 'A';
@@ -156,12 +158,13 @@ apr_size_t h2_util_base64url_decode(unsi
 
 int h2_util_contains_token(apr_pool_t *pool, const char *s, const char *token)
 {
+    char *c;
     if (s) {
         if (!apr_strnatcasecmp(s, token)) {   /* the simple life */
             return 1;
         }
         
-        for (char *c = ap_get_token(pool, &s, 0); c && *c;
+        for (c = ap_get_token(pool, &s, 0); c && *c;
              c = *s? ap_get_token(pool, &s, 0) : NULL) {
             if (!apr_strnatcasecmp(c, token)) { /* seeing the token? */
                 return 1;
@@ -180,10 +183,12 @@ int h2_util_contains_token(apr_pool_t *p
 const char *h2_util_first_token_match(apr_pool_t *pool, const char *s, 
                                       const char *tokens[], apr_size_t len)
 {
+    char *c;
+    apr_size_t i;
     if (s && *s) {
-        for (char *c = ap_get_token(pool, &s, 0); c && *c;
+        for (c = ap_get_token(pool, &s, 0); c && *c;
              c = *s? ap_get_token(pool, &s, 0) : NULL) {
-            for (apr_size_t i = 0; i < len; ++i) {
+            for (i = 0; i < len; ++i) {
                 if (!apr_strnatcasecmp(c, tokens[i])) {
                     return tokens[i];
                 }