json: Changes enum name of square brackets from list to array
Marked JSON_TOK_LIST_ as deprecated in favor of JSON_TOK_ARRAY_ Signed-off-by: Ramiro Merello <rmerello@itba.edu.ar>
This commit is contained in:
parent
17238ab26b
commit
28da82c0e1
2 changed files with 19 additions and 15 deletions
|
@ -306,7 +306,7 @@ static int element_token(enum json_tokens token)
|
|||
{
|
||||
switch (token) {
|
||||
case JSON_TOK_OBJECT_START:
|
||||
case JSON_TOK_LIST_START:
|
||||
case JSON_TOK_ARRAY_START:
|
||||
case JSON_TOK_STRING:
|
||||
case JSON_TOK_NUMBER:
|
||||
case JSON_TOK_TRUE:
|
||||
|
@ -375,7 +375,7 @@ static int arr_next(struct json_obj *json, struct token *value)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (value->type == JSON_TOK_LIST_END) {
|
||||
if (value->type == JSON_TOK_ARRAY_END) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ static int decode_value(struct json_obj *obj,
|
|||
return obj_parse(obj, descr->object.sub_descr,
|
||||
descr->object.sub_descr_len,
|
||||
field);
|
||||
case JSON_TOK_LIST_START:
|
||||
case JSON_TOK_ARRAY_START:
|
||||
return arr_parse(obj, descr->array.element_descr,
|
||||
descr->array.n_elements, field, val);
|
||||
case JSON_TOK_FALSE:
|
||||
|
@ -484,7 +484,7 @@ static ptrdiff_t get_elem_size(const struct json_obj_descr *descr)
|
|||
case JSON_TOK_TRUE:
|
||||
case JSON_TOK_FALSE:
|
||||
return sizeof(bool);
|
||||
case JSON_TOK_LIST_START:
|
||||
case JSON_TOK_ARRAY_START:
|
||||
return descr->array.n_elements * get_elem_size(descr->array.element_descr);
|
||||
case JSON_TOK_OBJECT_START: {
|
||||
ptrdiff_t total = 0;
|
||||
|
@ -523,7 +523,7 @@ static int arr_parse(struct json_obj *obj,
|
|||
}
|
||||
|
||||
while (!arr_next(obj, &value)) {
|
||||
if (value.type == JSON_TOK_LIST_END) {
|
||||
if (value.type == JSON_TOK_ARRAY_END) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -819,7 +819,7 @@ static int encode(const struct json_obj_descr *descr, const void *val,
|
|||
return bool_encode(ptr, append_bytes, data);
|
||||
case JSON_TOK_STRING:
|
||||
return str_encode(ptr, append_bytes, data);
|
||||
case JSON_TOK_LIST_START:
|
||||
case JSON_TOK_ARRAY_START:
|
||||
return arr_encode(descr->array.element_descr, ptr,
|
||||
val, append_bytes, data);
|
||||
case JSON_TOK_OBJECT_START:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue