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;
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);
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);
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;
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) {
apr_array_header_t *protos)
{
h2_config *cfg;
+ apr_size_t i;
check_sni_host(c);
cfg = h2_config_get(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,
{
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;
"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)) {
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;
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);
}
}
- 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;
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);
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);
}
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;
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;
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);
}
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;
{
apr_table_t *header;
h2_response *response = apr_pcalloc(pool, sizeof(h2_response));
+ int i;
if (response == NULL) {
return NULL;
}
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) {
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;
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;
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;
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';
}
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';
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;
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];
}