MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / overwrite_item

Function overwrite_item

cJSON_Utils.c:784–805  ·  view source on GitHub ↗

overwrite and existing item with another one and free resources on the way */

Source from the content-addressed store, hash-verified

782
783/* overwrite and existing item with another one and free resources on the way */
784static void overwrite_item(cJSON * const root, const cJSON replacement)
785{
786 if (root == NULL)
787 {
788 return;
789 }
790
791 if (root->string != NULL)
792 {
793 cJSON_free(root->string);
794 }
795 if (root->valuestring != NULL)
796 {
797 cJSON_free(root->valuestring);
798 }
799 if (root->child != NULL)
800 {
801 cJSON_Delete(root->child);
802 }
803
804 memcpy(root, &replacement, sizeof(cJSON));
805}
806
807static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_sensitive)
808{

Callers 1

apply_patchFunction · 0.85

Calls 2

cJSON_freeFunction · 0.85
cJSON_DeleteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…