Make the JSON code easier to analyze
Coverity reports the following false positive for the JSON code in stat.c:
CID 284826 (#1 of 1): Resource leak (RESOURCE_LEAK)
17. leaked_storage: Variable percentile_object going out of scope leaks the storage it points to.
Suppress this false positive by making the JSON code easier to analyze. The
changes in this patch are as follows:
- Change the macros in json.h into inline functions such that the compiler
performs argument type verification at compile time.
- Pass a struct json_value pointer to json_*_add_value_type() instead of
using varargs.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>