]> git.ipfire.org Git - thirdparty/grub.git/commit
json: Implement wrapping interface
authorPatrick Steinhardt <ps@pks.im>
Fri, 27 Dec 2019 15:18:35 +0000 (16:18 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 10 Jan 2020 13:13:22 +0000 (14:13 +0100)
commitc6a84545a3c21369bb2685fdbe3cd895733dedbd
tree021be82489c3cc55c5704202ae98b8e4f250f0de
parent528938d503088ce0e2fe7d83f8f711efefaed0fd
json: Implement wrapping interface

While the newly added jsmn library provides the parsing interface, it
does not provide any kind of interface to act on parsed tokens. Instead,
the caller is expected to handle pointer arithmetics inside of the token
array in order to extract required information. While simple, this
requires users to know some of the inner workings of the library and is
thus quite an unintuitive interface.

This commit adds a new interface on top of the jsmn parser that provides
convenience functions to retrieve values from the parsed json type, grub_json_t.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/lib/json/json.c
grub-core/lib/json/json.h [new file with mode: 0644]