in include/yyjson/yyjson.h [7317:7341]
yyjson_api_inline bool yyjson_mut_ptr_addx(yyjson_mut_val *val,
const char *ptr, size_t len,
yyjson_mut_val *new_val,
yyjson_mut_doc *doc,
bool create_parent,
yyjson_ptr_ctx *ctx,
yyjson_ptr_err *err) {
yyjson_ptr_set_err(NONE, NULL);
if (ctx) memset(ctx, 0, sizeof(*ctx));
if (yyjson_unlikely(!val || !ptr || !new_val || !doc)) {
yyjson_ptr_set_err(PARAMETER, "input parameter is NULL");
return false;
}
if (yyjson_unlikely(len == 0)) {
yyjson_ptr_set_err(SET_ROOT, "cannot set root");
return false;
}
if (yyjson_unlikely(*ptr != '/')) {
yyjson_ptr_set_err(SYNTAX, "no prefix '/'");
return false;
}
return unsafe_yyjson_mut_ptr_putx(val, ptr, len, new_val,
doc, create_parent, true, ctx, err);
}