From c329fd7bc81cbda3da6a3bd1104922c181635c99 Mon Sep 17 00:00:00 2001 From: Pierce Lopez Date: Fri, 7 Aug 2020 02:28:39 -0400 Subject: [PATCH] doc: add return types for function-like macros The Sphinx-3.0 c:function:: directive requires the return type. Sphinx-3.0 also adds function-like macro support to the c:macro:: directive, which Sphinx-1.x and Sphinx-2.x do not support, but it is probably a good idea to keep compatibility with slightly older Sphinx for now. --- doc/apiref.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/apiref.rst b/doc/apiref.rst index a793fad..94c5726 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -148,30 +148,30 @@ Type ``int``). *json* MUST NOT be *NULL*. This function is actually implemented as a macro for speed. -.. function:: json_is_object(const json_t *json) - json_is_array(const json_t *json) - json_is_string(const json_t *json) - json_is_integer(const json_t *json) - json_is_real(const json_t *json) - json_is_true(const json_t *json) - json_is_false(const json_t *json) - json_is_null(const json_t *json) +.. function:: int json_is_object(const json_t *json) + int json_is_array(const json_t *json) + int json_is_string(const json_t *json) + int json_is_integer(const json_t *json) + int json_is_real(const json_t *json) + int json_is_true(const json_t *json) + int json_is_false(const json_t *json) + int json_is_null(const json_t *json) These functions (actually macros) return true (non-zero) for values of the given type, and false (zero) for values of other types and for *NULL*. -.. function:: json_is_number(const json_t *json) +.. function:: int json_is_number(const json_t *json) Returns true for values of types ``JSON_INTEGER`` and ``JSON_REAL``, and false for other types and for *NULL*. -.. function:: json_is_boolean(const json_t *json) +.. function:: int json_is_boolean(const json_t *json) Returns true for types ``JSON_TRUE`` and ``JSON_FALSE``, and false for values of other types and for *NULL*. -.. function:: json_boolean_value(const json_t *json) +.. function:: int json_boolean_value(const json_t *json) Alias of :func:`json_is_true()`, i.e. returns 1 for ``JSON_TRUE`` and 0 otherwise. @@ -594,7 +594,7 @@ A JSON array is an ordered collection of other JSON values. Appends all elements in *other_array* to the end of *array*. Returns 0 on success and -1 on error. -.. function:: json_array_foreach(array, index, value) +.. function:: void json_array_foreach(array, index, value) Iterate over every element of ``array``, running the block of code that follows each time with the proper values set to @@ -764,7 +764,7 @@ allowed in object keys. .. versionadded:: 2.3 -.. function:: json_object_foreach_safe(object, tmp, key, value) +.. function:: void json_object_foreach_safe(object, tmp, key, value) Like :func:`json_object_foreach()`, but it's safe to call ``json_object_del(object, key)`` during iteration. You need to pass