From 9b17f64d301334b999a8138037d32ff72e951018 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Tue, 17 Oct 2023 18:59:02 +0100 Subject: examples/rust: Do some simplification around unsafe {} blocks We can put the unsafe keyword as part of the function definition, getting rid of the unsafe {} blocks in the functions themselves. Signed-off-by: Andrew Clayton --- examples/rust/large-upload/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/rust/large-upload/src/lib.rs') diff --git a/examples/rust/large-upload/src/lib.rs b/examples/rust/large-upload/src/lib.rs index a59bdb3..7fe8309 100644 --- a/examples/rust/large-upload/src/lib.rs +++ b/examples/rust/large-upload/src/lib.rs @@ -16,18 +16,18 @@ static mut REQUEST_BUF: *mut u8 = null_mut(); static mut TOTAL_BYTES_WROTE: u64 = 0; #[no_mangle] -pub extern "C" fn uwr_module_end_handler() { - unsafe { uwr_free(REQUEST_BUF); } +pub unsafe extern "C" fn uwr_module_end_handler() { + uwr_free(REQUEST_BUF); } #[no_mangle] -pub extern "C" fn uwr_module_init_handler() { - unsafe { REQUEST_BUF = uwr_malloc(uwr_mem_get_init_size()); } +pub unsafe extern "C" fn uwr_module_init_handler() { + REQUEST_BUF = uwr_malloc(uwr_mem_get_init_size()); } #[no_mangle] -pub extern "C" fn uwr_response_end_handler() { - unsafe { TOTAL_BYTES_WROTE = 0; } +pub unsafe extern "C" fn uwr_response_end_handler() { + TOTAL_BYTES_WROTE = 0; } #[no_mangle] -- cgit