cjson · Section 3
cjson_parse_n_mp, cjson_parse_n
NAME
cjson_parse_n_mp, cjson_parse_n - parse a bounded JSON buffer into a DOM tree
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cjson.h>
cjson cjson_parse_n_mp(const char *json_str, size_t len,
char **err_str, ccol_memmgmt_procs *mp);
/* convenience wrapper; default allocator */
static inline cjson cjson_parse_n(const char *json_str, size_t len,
char **err_str);
DESCRIPTION
Works like cjson_parse_mp(), but reads len bytes instead of a null-terminated string. cjson_parse_n() is a static inline wrapper that calls cjson_parse_n_mp(json_str, len, err_str, NULL).
PARAMETERS
json_str Input buffer, which doesn't need a null terminator.
len Number of bytes to parse.
err_str Out-parameter for the parse error message, with the same
rules as for cjson_parse_mp. Pass NULL to discard it.
mp Custom allocator for all nodes, or NULL for the default.
The library keeps its own copy of the struct, so the caller
may release or reuse the struct once this call returns.
The functions that it names must stay callable until the
last node built with them is destroyed. A process can use
at most 64 distinct sets of four functions, and a call that
would need a 65th fails and returns NULL.
RETURN VALUE
The root cjson node on success, NULL on failure.