| 766 | } |
| 767 | |
| 768 | static int toml_write_atomic(const char *requested_path, const char *old_data, size_t old_len, |
| 769 | const char *new_data, size_t new_len, |
| 770 | const toml_file_snapshot_t *snapshot) { |
| 771 | cbm_config_edit_target_t target; |
| 772 | if (cbm_config_edit_target_open(requested_path, &target) < 0) { |
| 773 | return TOML_EDIT_ERR; |
| 774 | } |
| 775 | int result = toml_write_atomic_at(&target, old_data, old_len, new_data, new_len, snapshot); |
| 776 | cbm_config_edit_target_close(&target); |
| 777 | return result; |
| 778 | } |
| 779 | |
| 780 | #ifdef CBM_TOML_EDIT_ENABLE_TEST_API |
| 781 | void cbm_toml_set_precommit_hook_for_testing(cbm_toml_precommit_test_hook_t hook, void *context) { |
no test coverage detected