From 6c78910011c5d10b9fcb95b6fdd038f4aa9bf74d Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Tue, 14 Nov 2017 23:15:53 -0500 Subject: apiref: Clarify documentation for unpack `O` format. The `O` format causes reference counts to increase, but in an error they are not released. Callers to unpack functions that use the `O` format should use pointers pre-initialized to NULL so they can safely release the reference on error. Also corrected typo which said this was like `O` (itself). Fixes #135 --- doc/apiref.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/apiref.rst b/doc/apiref.rst index 7afeb21..a8cf8d6 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -1564,7 +1564,10 @@ type whose address should be passed. Store a JSON value with no conversion to a :type:`json_t` pointer. ``O`` (any value) [json_t \*] - Like ``O``, but the JSON value's reference count is incremented. + Like ``o``, but the JSON value's reference count is incremented. + Storage pointers should be initialized NULL before using unpack. + The caller is responsible for releasing all references incremented + by unpack, even when an error occurs. ``[fmt]`` (array) Convert each item in the JSON array according to the inner format -- cgit v1.1