cJSON
cJSON copied to clipboard
added const to cJSON_AddItemReferenceTo* item argument
Referenced object should never be modified.
Internally, create_reference takes const cJSON* item anyway, and making this parameter const is on par with cJSON_CreateObjectReference, which also have const cJSON* child argument.
Typical use-case:
void my_function(const cJSON* obj)
{
cJSON* wrapper = cJSON_CreateObject();
cJSON_AddItemReferenceToObject(wrapper, "foobar", obj); // <--- this fails atm, const needs to be cast away
// ... do something
cJSON_Delete(wrapper);
}
This would be really nice to get merged.