Function

judo_free

Free the in-memory tree.

Since v1.0
enum judo_result judo_free(
judo_value *root, void *user_data, judo_memfunc memfunc)

Parameters 🔗

root in

Root of the in-memory JSON tree.

user_data in

User pointer to pass through to memfunc.

memfunc in

Memory allocator callback.

Return Value 🔗

JUDO_SUCCESS

If root was freed successfully.

JUDO_INVALID_OPERATION

If memfunc is NULL.

JUDO_MALFUNCTION

If there is a defect in the implementation.

Discussion 🔗

The judo_free function releases memory associated with root using memfunc. The root must reference the root of the tree as returned by judo_parse otherwise the behavior is undefined (do not attempt to free any value other than the root of the tree).

The memfunc function must implement a memory allocator as described in judo_memfunc. The user_data pointer is passed to memfunc as-is.