aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2011-08-08 20:59:10 +0300
committerPetri Lehtinen <petri@digip.org>2011-08-08 20:59:10 +0300
commitf241e14cab9b664be4a9c9f187c1e71aa25fc30f (patch)
tree932b7129f96d3567fbd6fb51a3a93b1a235d7a16
parent7fab57dcef5611b2275d9e11f39d887d92a1a7ff (diff)
downloadjansson-2.1.zip
jansson-2.1.tar.gz
jansson-2.1.tar.bz2
doc: Explain the non-constness of the first parameter of json_unpack() et al2.1
Fixes GH-30.
-rw-r--r--doc/apiref.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/apiref.rst b/doc/apiref.rst
index 4051b38..16da5f2 100644
--- a/doc/apiref.rst
+++ b/doc/apiref.rst
@@ -1047,6 +1047,20 @@ The following functions compose the parsing and validation API:
behaviour of the unpacker, see below for the flags. Returns 0 on
success and -1 on failure.
+.. note::
+
+ The first argument of all unpack functions is ``json_t *root``
+ instead of ``const json_t *root``, because the use of ``O`` format
+ character causes the reference count of ``root``, or some value
+ reachable from ``root``, to be increased. Furthermore, the ``o``
+ format character may be used to extract a value as-is, which allows
+ modifying the structure or contents of a value reachable from
+ ``root``.
+
+ If the ``O`` and ``o`` format character are not used, it's
+ perfectly safe to cast a ``const json_t *`` variable to plain
+ ``json_t *`` when used with these functions.
+
The following unpacking flags are available:
``JSON_STRICT``