nxt_conf.c (611:323e11065f83) nxt_conf.c (703:2d536dde84d2)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 1864 unchanged lines hidden (view full) ---

1873
1874
1875size_t
1876nxt_conf_json_length(nxt_conf_value_t *value, nxt_conf_json_pretty_t *pretty)
1877{
1878 switch (value->type) {
1879
1880 case NXT_CONF_VALUE_NULL:
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 1864 unchanged lines hidden (view full) ---

1873
1874
1875size_t
1876nxt_conf_json_length(nxt_conf_value_t *value, nxt_conf_json_pretty_t *pretty)
1877{
1878 switch (value->type) {
1879
1880 case NXT_CONF_VALUE_NULL:
1881 return sizeof("null") - 1;
1881 return nxt_length("null");
1882
1883 case NXT_CONF_VALUE_BOOLEAN:
1882
1883 case NXT_CONF_VALUE_BOOLEAN:
1884 return value->u.boolean ? sizeof("true") - 1 : sizeof("false") - 1;
1884 return value->u.boolean ? nxt_length("true") : nxt_length("false");
1885
1886 case NXT_CONF_VALUE_INTEGER:
1887 return nxt_conf_json_integer_length(value);
1888
1889 case NXT_CONF_VALUE_NUMBER:
1890 /* TODO */
1891 return 0;
1892

--- 54 unchanged lines hidden (view full) ---

1947static size_t
1948nxt_conf_json_integer_length(nxt_conf_value_t *value)
1949{
1950 int64_t num;
1951
1952 num = llabs(value->u.integer);
1953
1954 if (num <= 9999) {
1885
1886 case NXT_CONF_VALUE_INTEGER:
1887 return nxt_conf_json_integer_length(value);
1888
1889 case NXT_CONF_VALUE_NUMBER:
1890 /* TODO */
1891 return 0;
1892

--- 54 unchanged lines hidden (view full) ---

1947static size_t
1948nxt_conf_json_integer_length(nxt_conf_value_t *value)
1949{
1950 int64_t num;
1951
1952 num = llabs(value->u.integer);
1953
1954 if (num <= 9999) {
1955 return sizeof("-9999") - 1;
1955 return nxt_length("-9999");
1956 }
1957
1958 if (num <= 99999999999LL) {
1956 }
1957
1958 if (num <= 99999999999LL) {
1959 return sizeof("-99999999999") - 1;
1959 return nxt_length("-99999999999");
1960 }
1961
1962 return NXT_INT64_T_LEN;
1963}
1964
1965
1966static u_char *
1967nxt_conf_json_print_integer(u_char *p, nxt_conf_value_t *value)

--- 364 unchanged lines hidden ---
1960 }
1961
1962 return NXT_INT64_T_LEN;
1963}
1964
1965
1966static u_char *
1967nxt_conf_json_print_integer(u_char *p, nxt_conf_value_t *value)

--- 364 unchanged lines hidden ---