diff options
-rw-r--r-- | src/nxt_conf.h | 2 | ||||
-rw-r--r-- | src/nxt_conf_json.c | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/nxt_conf.h b/src/nxt_conf.h index 4fe88404..fdb324d7 100644 --- a/src/nxt_conf.h +++ b/src/nxt_conf.h @@ -43,6 +43,8 @@ nxt_conf_json_value_t *nxt_conf_json_get_value(nxt_conf_json_value_t *value, nxt_str_t *path); nxt_conf_json_value_t *nxt_conf_json_object_get_member( nxt_conf_json_value_t *value, nxt_str_t *name, uint32_t *index); +nxt_conf_json_value_t *nxt_conf_json_object_next_member( + nxt_conf_json_value_t *value, nxt_str_t *name, uint32_t *next); nxt_int_t nxt_conf_json_object_map(nxt_conf_json_value_t *value, nxt_conf_json_object_map_t *map, void *data); diff --git a/src/nxt_conf_json.c b/src/nxt_conf_json.c index 0f4b3271..45682245 100644 --- a/src/nxt_conf_json.c +++ b/src/nxt_conf_json.c @@ -370,6 +370,34 @@ nxt_conf_json_object_map(nxt_conf_json_value_t *value, } +nxt_conf_json_value_t * +nxt_conf_json_object_next_member(nxt_conf_json_value_t *value, nxt_str_t *name, + uint32_t *next) +{ + uint32_t n; + nxt_conf_json_object_t *object; + nxt_conf_json_obj_member_t *member; + + if (value->type != NXT_CONF_JSON_OBJECT) { + return NULL; + } + + n = *next; + object = value->u.object; + + if (n >= object->count) { + return NULL; + } + + member = &object->members[n]; + *next = n + 1; + + nxt_conf_json_value_get_string(&member->name, name); + + return &member->value; +} + + nxt_int_t nxt_conf_json_op_compile(nxt_mp_t *mp, nxt_conf_json_op_t **ops, nxt_conf_json_value_t *root, nxt_str_t *path, |