nxt_conf.c (2076:1be3131609fd) nxt_conf.c (2139:99d792169ffb)
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>

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

97 nxt_bool_t last;
98 u_char buf[NXT_CONF_MAX_TOKEN_LEN];
99} nxt_conf_path_parse_t;
100
101
102static nxt_int_t nxt_conf_path_next_token(nxt_conf_path_parse_t *parse,
103 nxt_str_t *token);
104
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>

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

97 nxt_bool_t last;
98 u_char buf[NXT_CONF_MAX_TOKEN_LEN];
99} nxt_conf_path_parse_t;
100
101
102static nxt_int_t nxt_conf_path_next_token(nxt_conf_path_parse_t *parse,
103 nxt_str_t *token);
104
105static u_char *nxt_conf_json_skip_space(u_char *start, u_char *end);
105static u_char *nxt_conf_json_skip_space(u_char *start, const u_char *end);
106static u_char *nxt_conf_json_parse_value(nxt_mp_t *mp, nxt_conf_value_t *value,
107 u_char *start, u_char *end, nxt_conf_json_error_t *error);
108static u_char *nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value,
109 u_char *start, u_char *end, nxt_conf_json_error_t *error);
110static nxt_int_t nxt_conf_object_hash_add(nxt_mp_t *mp,
111 nxt_lvlhsh_t *lvlhsh, nxt_conf_object_member_t *member);
112static nxt_int_t nxt_conf_object_hash_test(nxt_lvlhsh_query_t *lhq,
113 void *data);

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

261 value->type = NXT_CONF_VALUE_OBJECT;
262
263 return value;
264}
265
266
267void
268nxt_conf_set_member(nxt_conf_value_t *object, nxt_str_t *name,
106static u_char *nxt_conf_json_parse_value(nxt_mp_t *mp, nxt_conf_value_t *value,
107 u_char *start, u_char *end, nxt_conf_json_error_t *error);
108static u_char *nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value,
109 u_char *start, u_char *end, nxt_conf_json_error_t *error);
110static nxt_int_t nxt_conf_object_hash_add(nxt_mp_t *mp,
111 nxt_lvlhsh_t *lvlhsh, nxt_conf_object_member_t *member);
112static nxt_int_t nxt_conf_object_hash_test(nxt_lvlhsh_query_t *lhq,
113 void *data);

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

261 value->type = NXT_CONF_VALUE_OBJECT;
262
263 return value;
264}
265
266
267void
268nxt_conf_set_member(nxt_conf_value_t *object, nxt_str_t *name,
269 nxt_conf_value_t *value, uint32_t index)
269 const nxt_conf_value_t *value, uint32_t index)
270{
271 nxt_conf_object_member_t *member;
272
273 member = &object->u.object->members[index];
274
275 nxt_conf_set_string(&member->name, name);
276
277 member->value = *value;

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

362 value->type = NXT_CONF_VALUE_ARRAY;
363
364 return value;
365}
366
367
368void
369nxt_conf_set_element(nxt_conf_value_t *array, nxt_uint_t index,
270{
271 nxt_conf_object_member_t *member;
272
273 member = &object->u.object->members[index];
274
275 nxt_conf_set_string(&member->name, name);
276
277 member->value = *value;

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

362 value->type = NXT_CONF_VALUE_ARRAY;
363
364 return value;
365}
366
367
368void
369nxt_conf_set_element(nxt_conf_value_t *array, nxt_uint_t index,
370 nxt_conf_value_t *value)
370 const nxt_conf_value_t *value)
371{
372 array->u.array->elements[index] = *value;
373}
374
375
376nxt_int_t
377nxt_conf_set_element_string_dup(nxt_conf_value_t *array, nxt_mp_t *mp,
378 nxt_uint_t index, nxt_str_t *value)

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

1266 return NULL;
1267 }
1268
1269 return value;
1270}
1271
1272
1273static u_char *
371{
372 array->u.array->elements[index] = *value;
373}
374
375
376nxt_int_t
377nxt_conf_set_element_string_dup(nxt_conf_value_t *array, nxt_mp_t *mp,
378 nxt_uint_t index, nxt_str_t *value)

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

1266 return NULL;
1267 }
1268
1269 return value;
1270}
1271
1272
1273static u_char *
1274nxt_conf_json_skip_space(u_char *start, u_char *end)
1274nxt_conf_json_skip_space(u_char *start, const u_char *end)
1275{
1276 u_char *p, ch;
1277
1278 enum {
1279 sw_normal = 0,
1280 sw_after_slash,
1281 sw_single_comment,
1282 sw_multi_comment,

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

2600 size--;
2601 }
2602
2603 return dst;
2604}
2605
2606
2607void
1275{
1276 u_char *p, ch;
1277
1278 enum {
1279 sw_normal = 0,
1280 sw_after_slash,
1281 sw_single_comment,
1282 sw_multi_comment,

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

2600 size--;
2601 }
2602
2603 return dst;
2604}
2605
2606
2607void
2608nxt_conf_json_position(u_char *start, u_char *pos, nxt_uint_t *line,
2608nxt_conf_json_position(u_char *start, const u_char *pos, nxt_uint_t *line,
2609 nxt_uint_t *column)
2610{
2611 u_char *p;
2612 ssize_t symbols;
2613 nxt_uint_t lines;
2614
2615 lines = 1;
2616

--- 17 unchanged lines hidden ---
2609 nxt_uint_t *column)
2610{
2611 u_char *p;
2612 ssize_t symbols;
2613 nxt_uint_t lines;
2614
2615 lines = 1;
2616

--- 17 unchanged lines hidden ---