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
This commit is contained in:
Corey Farrell 2017-11-14 23:15:53 -05:00
parent 89dad8959b
commit 6c78910011

View File

@ -1564,7 +1564,10 @@ type whose address should be passed.
Store a JSON value with no conversion to a :type:`json_t` pointer. Store a JSON value with no conversion to a :type:`json_t` pointer.
``O`` (any value) [json_t \*] ``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) ``[fmt]`` (array)
Convert each item in the JSON array according to the inner format Convert each item in the JSON array according to the inner format