Skip to content

Commit

Permalink
minor stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lyokha committed Jul 24, 2018
1 parent 7fc3681 commit 0fcbb2b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ngx_http_custom_counters_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,9 @@ ngx_http_cnt_shm_init(ngx_shm_zone_t *shm_zone, void *data)
return NGX_OK;
} else {
ngx_log_error(NGX_LOG_WARN, shm_zone->shm.log, 0,
"custom counters set \"%V\" cannot survive reload "
"because its size has changed", &cnt_set->name);
"custom counters set \"%V\" cannot survive "
"reload because its size has changed",
&cnt_set->name);
}
} else if (nelts <= oshm_data[0]) {
ngx_shmtx_lock(&shpool->mutex);
Expand All @@ -433,7 +434,7 @@ ngx_http_cnt_shm_init(ngx_shm_zone_t *shm_zone, void *data)
shm_data[0] = nelts;

/* FIXME: this is not always safe: too slow workers may write in recently
* allocated areas when nginx reloads its configuration too fast and having
* allocated areas when nginx reloads its configuration too fast and having
* been already freed areas get reused */
if (oshm_data != NULL) {
ngx_slab_free_locked(shpool, oshm_data);
Expand Down Expand Up @@ -484,8 +485,7 @@ ngx_http_cnt_get_value(ngx_http_request_t *r, ngx_http_variable_value_t *v,
return NGX_ERROR;
}

for (i = 0; i < v_data->nelts; i++)
{
for (i = 0; i < v_data->nelts; i++) {
if (var_data[i].cnt_set != scf->cnt_set) {
continue;
}
Expand Down Expand Up @@ -556,8 +556,7 @@ ngx_http_cnt_counter_impl(ngx_conf_t *cf, ngx_command_t *cmd, void *conf,
}
cnt_set_id = ((ngx_http_server_name_t *) cscf->server_names.elts)[
cscf->server_names.nelts - 1].name;
if (cnt_set_id.len == 0)
{
if (cnt_set_id.len == 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"custom counters require directive "
"\"counter_set_id\" or non-empty last server "
Expand Down Expand Up @@ -642,8 +641,7 @@ ngx_http_cnt_counter_impl(ngx_conf_t *cf, ngx_command_t *cmd, void *conf,
cnt_sets = mcf->cnt_sets.elts;
cnt_set = &cnt_sets[scf->cnt_set];
vars = cnt_set->vars.elts;
for (i = 0; i < cnt_set->vars.nelts; i++)
{
for (i = 0; i < cnt_set->vars.nelts; i++) {
if (vars[i] == (ngx_uint_t) v_idx) {
idx = i;
break;
Expand Down

0 comments on commit 0fcbb2b

Please sign in to comment.