MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / ckpt_json_delete

Function ckpt_json_delete

common/script/json_api.cpp:79–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void ckpt_json_delete(struct ParseState* Parser, struct Value* ReturnValue, struct Value** Param, int NumArgs)
80{
81 // json_array_element/json_object_element return borrowed pointers into a
82 // parent tree with the same struct JSON* type as an owned root, so this is
83 // the one place that can tell the two apart: only a root json_new adopted
84 // is in the heap. Deleting a borrowed element used to corrupt the
85 // allocator; now it fails the script where the mistake was made.
86 const ScriptArgs args(Parser, Param, NumArgs, "json_delete");
87 if (!ScriptHeap::get().release(tree(args, 0))) {
88 args.fail("argument 1 is not a json_new root");
89 }
90}
91
92void ckpt_json_is_valid(struct ParseState* Parser, struct Value* ReturnValue, struct Value** Param, int NumArgs)
93{

Callers

nothing calls this directly

Calls 4

getFunction · 0.85
treeFunction · 0.85
releaseMethod · 0.80
failMethod · 0.80

Tested by

no test coverage detected