spa: add spa_json_begin

That combines spa_json_init() and spa_json_next, a common thing to do.
This commit is contained in:
Wim Taymans 2024-09-13 09:22:27 +02:00
parent 08057e0328
commit feccb882b6
7 changed files with 15 additions and 18 deletions

View file

@ -123,8 +123,7 @@ static int process_json(const char *filename, void *buf, size_t size)
struct spa_json it;
const char *value;
spa_json_init(&it, buf, size);
if ((len = spa_json_next(&it, &value)) <= 0) {
if ((len = spa_json_begin(&it, buf, size, &value)) <= 0) {
fprintf(stderr, "not a valid file '%s': %s\n", filename, spa_strerror(len));
return -EINVAL;
}