diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-06-28 15:26:54 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-06-28 15:26:54 +0300 |
commit | ee381fcca128d8eccf498ef19f68639504b5f4a6 (patch) | |
tree | 59f9743d9ee9a51be8885f21ae38ffc0e7512d41 /src/nxt_conf_json.c | |
parent | d8f371dde9dd660c6067a173e70289c33e2a26c0 (diff) | |
download | unit-ee381fcca128d8eccf498ef19f68639504b5f4a6.tar.gz unit-ee381fcca128d8eccf498ef19f68639504b5f4a6.tar.bz2 |
JSON property iterator nxt_conf_json_object_next_member().
Diffstat (limited to 'src/nxt_conf_json.c')
-rw-r--r-- | src/nxt_conf_json.c | 28 |
1 files changed, 28 insertions, 0 deletions
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, |