diff options
author | Petri Lehtinen <petri@digip.org> | 2009-09-06 22:24:55 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2009-09-06 22:24:55 +0300 |
commit | 234ee4728124d8d07412d159b45dd10854b6d6d8 (patch) | |
tree | 01c5714c029aed649720a09f5d1d85d28ebcbf9d /doc | |
parent | 98a8c1aebff7a414f0830bc4f6b7bee19405f865 (diff) | |
download | jansson-234ee4728124d8d07412d159b45dd10854b6d6d8.zip jansson-234ee4728124d8d07412d159b45dd10854b6d6d8.tar.gz jansson-234ee4728124d8d07412d159b45dd10854b6d6d8.tar.bz2 |
Better argument validation
All pointer arguments are now tested for NULL. json_string() now also
tests that strdup() succeeds. This is to ensure that no NULL values
end up in data structures.
Also desribe the different sources of errors in documentation.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/apiref.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/apiref.rst b/doc/apiref.rst index db9b5a4..ea38343 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -41,6 +41,12 @@ Objects of :ctype:`json_t` are always used through a pointer. There are APIs for querying the type, manipulating the reference count, and for constructing and manipulating values of different types. +Unless noted otherwise, all API functions return an error value if an +error occurs. Depending on the function's signature, the error value +is either *NULL* or -1. Invalid arguments or invalid input are +apparent sources for errors. Memory allocation and I/O operations may +also cause errors. + Type ---- @@ -80,8 +86,8 @@ functions: .. cfunction:: int json_typeof(const json_t *json) Return the type of the JSON value (a :ctype:`json_type` cast to - :ctype:`int`). This function is actually implemented as a macro for - speed. + :ctype:`int`). *json* MUST NOT be *NULL*. This function is actually + implemented as a macro for speed. .. cfunction:: json_is_object(const json_t *json) json_is_array(const json_t *json) |