| 66 | return document; |
| 67 | } |
| 68 | static char *apply(const char *path, const char *changes, int *status) { |
| 69 | yyjson_doc *before = read_snapshot(path); |
| 70 | if (!before) |
| 71 | return NULL; |
| 72 | const char *revision = yyjson_get_str(yyjson_obj_get(yyjson_doc_get_root(before), "revision")); |
| 73 | char request[4096]; |
| 74 | snprintf(request, sizeof(request), "{\"revision\":\"%s\",\"changes\":%s}", revision, changes); |
| 75 | yyjson_doc_free(before); |
| 76 | return cbm_runtime_settings_apply_json(path, request, strlen(request), status); |
| 77 | } |
| 78 | |
| 79 | TEST(runtime_settings_atomic_validation_and_conflict) { |
| 80 | settings_fixture_t fixture; |
no test coverage detected