mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-15 07:00:05 -05:00
spa: add spa_json_begin
That combines spa_json_init() and spa_json_next, a common thing to do.
This commit is contained in:
parent
08057e0328
commit
feccb882b6
7 changed files with 15 additions and 18 deletions
|
|
@ -139,8 +139,7 @@ static inline int spa_json_to_pod(struct spa_pod_builder *b, uint32_t flags,
|
|||
struct spa_json iter;
|
||||
const char *val;
|
||||
|
||||
spa_json_init(&iter, value, len);
|
||||
if ((len = spa_json_next(&iter, &val)) <= 0)
|
||||
if ((len = spa_json_begin(&iter, value, len, &val)) <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
return spa_json_to_pod_part(b, flags, info->type, info, &iter, val, len);
|
||||
|
|
|
|||
|
|
@ -356,6 +356,12 @@ static inline bool spa_json_get_error(struct spa_json *iter, const char *start,
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline int spa_json_begin(struct spa_json * iter, const char *data, size_t size, const char **val)
|
||||
{
|
||||
spa_json_init(iter, data, size);
|
||||
return spa_json_next(iter, val);
|
||||
}
|
||||
|
||||
static inline int spa_json_enter_container(struct spa_json *iter, struct spa_json *sub, char type)
|
||||
{
|
||||
const char *value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue