From 76300601d9cb3f8756dd94f0f8a354ff844ae686 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Fri, 8 Mar 2019 12:57:59 -0500 Subject: Add runtime version checking functions This patch adds two new exported functions: * `jansson_version_str` - Returns a human-readable version number * `jansson_version_cmp` - Returns an integer less than, equal to, or greater than zero if the runtime version of Jansson is found, respectively, to be less than, to match, or be greater than the provided major, minor, and micro. --- doc/apiref.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc') diff --git a/doc/apiref.rst b/doc/apiref.rst index 3945c11..1b305f5 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -58,6 +58,25 @@ the library: /* Code specific to version 1.3 and above */ #endif +Additionally, there are functions to determine the version of Jansson at +runtime: + +.. function:: const char *jansson_version_str() + + Return the version of the Jansson library, in the same format as + the ``JANSSON_VERSION`` preprocessor constant. + + .. versionadded:: 2.13 + +.. function:: int jansson_version_cmp(int major, int minor, int micro) + + Returns an integer less than, equal to, or greater than zero if + the runtime version of Jansson is found, respectively, to be less + than, to match, or be greater than the provided *major*, *minor*, and + *micro*. + + .. versionadded:: 2.13 + ``JANSSON_THREAD_SAFE_REFCOUNT`` If this value is defined all read-only operations and reference counting in Jansson are thread safe. This value is not defined for versions older than -- cgit v1.1