| 1057 | } |
| 1058 | |
| 1059 | CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON *const object, const cJSON *const patches) |
| 1060 | { |
| 1061 | const cJSON *current_patch = NULL; |
| 1062 | int status = 0; |
| 1063 | |
| 1064 | if (!cJSON_IsArray(patches)) |
| 1065 | { |
| 1066 | /* malformed patches. */ |
| 1067 | return 1; |
| 1068 | } |
| 1069 | |
| 1070 | if (patches != NULL) |
| 1071 | { |
| 1072 | current_patch = patches->child; |
| 1073 | } |
| 1074 | |
| 1075 | while (current_patch != NULL) |
| 1076 | { |
| 1077 | status = apply_patch(object, current_patch, false); |
| 1078 | if (status != 0) |
| 1079 | { |
| 1080 | return status; |
| 1081 | } |
| 1082 | current_patch = current_patch->next; |
| 1083 | } |
| 1084 | |
| 1085 | return 0; |
| 1086 | } |
| 1087 | |
| 1088 | CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON *const object, const cJSON *const patches) |
| 1089 | { |
nothing calls this directly
no test coverage detected