Permalink
Browse files

style: fixed minor coding style issues found by ngx-releng.

  • Loading branch information...
agentzh committed Jan 21, 2018
1 parent 0cde4c7 commit 6b10a63f53e34c3e4566e8b6b7cc9e89daf3085f
@@ -535,8 +535,7 @@ ngx_http_rds_json_ret(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
done:
- clcf = ngx_http_conf_get_module_loc_conf(cf,
- ngx_http_core_module);
+ clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
if (clcf == NULL) {
return NGX_CONF_ERROR;
}
@@ -24,8 +24,7 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
dd("entered ret handler");
- conf = ngx_http_get_module_loc_conf(r,
- ngx_http_rds_json_filter_module);
+ conf = ngx_http_get_module_loc_conf(r, ngx_http_rds_json_filter_module);
/* evaluate the final value of conf->errstr */
@@ -43,8 +42,8 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
;
if (errstr.len) {
- escape = ngx_http_rds_json_escape_json_str(NULL,
- errstr.data, errstr.len);
+ escape = ngx_http_rds_json_escape_json_str(NULL, errstr.data,
+ errstr.len);
len += sizeof(",") - 1
+ conf->errstr_key.len
@@ -58,6 +57,7 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
if (conf->success.len) {
len += conf->success.len + sizeof(":,") - 1;
+
if (ngx_atoi(conf->errcode.data, conf->errcode.len) == 0) {
len += sizeof("true") - 1;
@@ -68,15 +68,15 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
if (conf->user_props) {
values = ngx_pnalloc(r->pool,
- conf->user_props->nelts * (sizeof(ngx_str_t) +
- sizeof(uintptr_t)));
+ conf->user_props->nelts
+ * (sizeof(ngx_str_t) + sizeof(uintptr_t)));
if (values == NULL) {
return NGX_ERROR;
}
escapes = (uintptr_t *) ((u_char *) values +
- conf->user_props->nelts * sizeof(ngx_str_t));
+ conf->user_props->nelts * sizeof(ngx_str_t));
prop = conf->user_props->elts;
for (i = 0; i < conf->user_props->nelts; i++) {
@@ -87,7 +87,7 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
}
escapes[i] = ngx_http_rds_json_escape_json_str(NULL, values[i].data,
- values[i].len);
+ values[i].len);
len += sizeof(":\"\",") - 1 + prop[i].key.len + values[i].len
+ escapes[i];
@@ -124,8 +124,8 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
if (errstr.len) {
*b->last++ = ',';
- b->last = ngx_copy(b->last,
- conf->errstr_key.data, conf->errstr_key.len);
+ b->last = ngx_copy(b->last, conf->errstr_key.data,
+ conf->errstr_key.len);
*b->last++ = ':';
*b->last++ = '"';
@@ -174,7 +174,7 @@ ngx_http_rds_json_ret_handler(ngx_http_request_t *r)
if (b->last != b->end) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "rds_json: rds_json_ret: buffer error");
+ "rds_json: rds_json_ret: buffer error");
return NGX_ERROR;
}
@@ -152,15 +152,15 @@ ngx_http_rds_json_output_header(ngx_http_request_t *r,
if (conf->user_props) {
values = ngx_pnalloc(r->pool,
- conf->user_props->nelts * (sizeof(ngx_str_t)
- + sizeof(uintptr_t)));
+ conf->user_props->nelts
+ * (sizeof(ngx_str_t) + sizeof(uintptr_t)));
if (values == NULL) {
return NGX_ERROR;
}
escapes = (uintptr_t *) ((u_char *) values
- + conf->user_props->nelts * sizeof(ngx_str_t));
+ + conf->user_props->nelts * sizeof(ngx_str_t));
prop = conf->user_props->elts;
for (i = 0; i < conf->user_props->nelts; i++) {
@@ -327,15 +327,16 @@ ngx_http_rds_json_output_props(ngx_http_request_t *r,
if (conf->user_props) {
values = ngx_pnalloc(r->pool,
- conf->user_props->nelts * (sizeof(ngx_str_t)
- + sizeof(uintptr_t)));
+ conf->user_props->nelts
+ * (sizeof(ngx_str_t) + sizeof(uintptr_t)));
if (values == NULL) {
return NGX_ERROR;
}
escapes = (uintptr_t *) ((u_char *) values
- + conf->user_props->nelts * sizeof(ngx_str_t));
+ + conf->user_props->nelts
+ * sizeof(ngx_str_t));
prop = conf->user_props->elts;
for (i = 0; i < conf->user_props->nelts; i++) {
@@ -873,14 +874,14 @@ ngx_http_rds_json_output_more_field_data(ngx_http_request_t *r,
} else {
dd("more field data: string value escape non-zero: %d",
- (int) escape);
+ (int) escape);
#if DDEBUG
p = last;
#endif
last = (u_char *) ngx_http_rds_json_escape_json_str(last,
- data, len);
+ data, len);
#if DDEBUG
dd("escaped value \"%.*s\" (len %d, escape %d, escape2 %d)",
@@ -145,7 +145,8 @@ ngx_http_rds_json_discard_bufs(ngx_pool_t *pool, ngx_chain_t *in)
for (cl = in; cl; cl = cl->next) {
#if 0
if (cl->buf->temporary
- && ngx_buf_size(cl->buf) > 0) {
+ && ngx_buf_size(cl->buf) > 0)
+ {
ngx_pfree(pool, cl->buf->start);
}
#endif

0 comments on commit 6b10a63

Please sign in to comment.