| 1086 | } |
| 1087 | |
| 1088 | CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON *const object, const cJSON *const patches) |
| 1089 | { |
| 1090 | const cJSON *current_patch = NULL; |
| 1091 | int status = 0; |
| 1092 | |
| 1093 | if (!cJSON_IsArray(patches)) |
| 1094 | { |
| 1095 | /* malformed patches. */ |
| 1096 | return 1; |
| 1097 | } |
| 1098 | |
| 1099 | if (patches != NULL) |
| 1100 | { |
| 1101 | current_patch = patches->child; |
| 1102 | } |
| 1103 | |
| 1104 | while (current_patch != NULL) |
| 1105 | { |
| 1106 | status = apply_patch(object, current_patch, true); |
| 1107 | if (status != 0) |
| 1108 | { |
| 1109 | return status; |
| 1110 | } |
| 1111 | current_patch = current_patch->next; |
| 1112 | } |
| 1113 | |
| 1114 | return 0; |
| 1115 | } |
| 1116 | |
| 1117 | static void compose_patch(cJSON *const patches, const unsigned char *const operation, const unsigned char *const path, |
| 1118 | const unsigned char *suffix, const cJSON *const value) |
nothing calls this directly
no test coverage detected