Add a json_object_from_fd_ex() function, to allow the max nesting depth to be specified.

This commit is contained in:
Eric Haszlakiewicz
2019-11-10 00:12:27 -05:00
parent ac26ea9c5b
commit baed9983b3
6 changed files with 94 additions and 7 deletions

View File

@@ -50,8 +50,20 @@ JSON_EXPORT struct json_object* json_object_from_file(const char *filename);
* Note, that the fd must be readable at the actual position, i.e.
* use lseek(fd, 0, SEEK_SET) before.
*
* The depth argument specifies the maximum object depth to pass to
* json_tokener_new_ex(). When depth == -1, JSON_TOKENER_DEFAULT_DEPTH
* is used instead.
*
* Returns NULL on failure. See json_util_get_last_err() for details.
*/
JSON_EXPORT struct json_object* json_object_from_fd_ex(int fd, int depth);
/**
* Create a JSON object from an already opened file descriptor, using
* the default maximum object depth. (JSON_TOKENER_DEFAULT_DEPTH)
*
* See json_object_from_fd_ex() for details.
*/
JSON_EXPORT struct json_object* json_object_from_fd(int fd);
/**