in include/yyjson/yyjson.h [7421:7448]
yyjson_api_inline bool yyjson_mut_ptr_setx(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 || !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;
}
if (!new_val) {
return !!unsafe_yyjson_mut_ptr_removex(val, ptr, len, ctx, err);
}
return unsafe_yyjson_mut_ptr_putx(val, ptr, len, new_val, doc,
create_parent, false, ctx, err);
}