Lines Matching refs:patches
1055 CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches)
1060 if (!cJSON_IsArray(patches))
1062 /* malformed patches. */
1066 if (patches != NULL)
1068 current_patch = patches->child;
1084 CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches)
1089 if (!cJSON_IsArray(patches))
1091 /* malformed patches. */
1095 if (patches != NULL)
1097 current_patch = patches->child;
1113 static void compose_patch(cJSON * const patches, const unsigned char * const operation, const unsigned char * const path, const unsigned char *suffix, const cJSON * const value)
1117 if ((patches == NULL) || (operation == NULL) || (path == NULL))
1150 cJSON_AddItemToArray(patches, patch);
1158 static void create_patches(cJSON * const patches, const unsigned char * const path, cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive)
1167 compose_patch(patches, (const unsigned char*)"replace", path, 0, to);
1176 compose_patch(patches, (const unsigned char*)"replace", path, NULL, to);
1183 compose_patch(patches, (const unsigned char*)"replace", path, NULL, to);
1194 /* generate patches for all array elements that exist in both "from" and "to" */
1206 create_patches(patches, new_path, from_child, to_child, case_sensitive);
1221 compose_patch(patches, (const unsigned char*)"remove", path, new_path, NULL);
1226 compose_patch(patches, (const unsigned char*)"add", path, (const unsigned char*)"-", to_child);
1269 create_patches(patches, new_path, from_child, to_child, case_sensitive);
1278 compose_patch(patches, (const unsigned char*)"remove", path, (unsigned char*)from_child->string, NULL);
1285 compose_patch(patches, (const unsigned char*)"add", path, (unsigned char*)to_child->string, to_child);
1300 cJSON *patches = NULL;
1307 patches = cJSON_CreateArray();
1308 create_patches(patches, (const unsigned char*)"", from, to, false);
1310 return patches;
1315 cJSON *patches = NULL;
1322 patches = cJSON_CreateArray();
1323 create_patches(patches, (const unsigned char*)"", from, to, true);
1325 return patches;