summaryrefslogtreecommitdiff
path: root/json_util.h
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2019-11-10 00:12:27 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2019-11-10 00:14:44 -0500
commitbaed9983b30b46cf6685a061632bbc42cec0ce8d (patch)
tree064180d4b9fc0701e560b6ab909bd1af877ca667 /json_util.h
parentac26ea9c5bb42bd19aa466acea830a90435d65de (diff)
downloadjson-c-baed9983b30b46cf6685a061632bbc42cec0ce8d.tar.gz
Add a json_object_from_fd_ex() function, to allow the max nesting depth to be specified.
Diffstat (limited to 'json_util.h')
-rw-r--r--json_util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/json_util.h b/json_util.h
index 70a7d56..9620809 100644
--- a/json_util.h
+++ b/json_util.h
@@ -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);
/**