Configuration printing functions splitted in two parts.

Requested by Igor.
This commit is contained in:
Valentin Bartenev
2017-06-23 23:28:37 +03:00
parent 72429410f7
commit 9399a04121
3 changed files with 243 additions and 192 deletions

View File

@@ -786,7 +786,7 @@ nxt_controller_response_body(nxt_controller_response_t *resp, nxt_mp_t *pool)
nxt_memzero(&pretty, sizeof(nxt_conf_json_pretty_t));
size = nxt_conf_json_print_value(NULL, value, &pretty) + 2;
size = nxt_conf_json_value_length(value, &pretty) + 2;
b = nxt_buf_mem_alloc(pool, size, 0);
if (nxt_slow_path(b == NULL)) {
@@ -795,8 +795,7 @@ nxt_controller_response_body(nxt_controller_response_t *resp, nxt_mp_t *pool)
nxt_memzero(&pretty, sizeof(nxt_conf_json_pretty_t));
b->mem.free = (u_char *) nxt_conf_json_print_value(b->mem.free, value,
&pretty);
b->mem.free = nxt_conf_json_value_print(b->mem.free, value, &pretty);
*b->mem.free++ = '\r';
*b->mem.free++ = '\n';