summaryrefslogtreecommitdiffhomepage
path: root/examples/rust
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rust')
-rw-r--r--examples/rust/echo-request/src/lib.rs12
-rw-r--r--examples/rust/large-upload/src/lib.rs12
-rw-r--r--examples/rust/upload-reflector/src/lib.rs20
3 files changed, 18 insertions, 26 deletions
diff --git a/examples/rust/echo-request/src/lib.rs b/examples/rust/echo-request/src/lib.rs
index 943c514..674bb05 100644
--- a/examples/rust/echo-request/src/lib.rs
+++ b/examples/rust/echo-request/src/lib.rs
@@ -17,17 +17,13 @@ use std::ptr::null_mut;
static mut REQUEST_BUF: *mut u8 = null_mut();
#[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());
}
pub extern "C" fn hdr_iter_func(
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]
diff --git a/examples/rust/upload-reflector/src/lib.rs b/examples/rust/upload-reflector/src/lib.rs
index ac48b56..ccef351 100644
--- a/examples/rust/upload-reflector/src/lib.rs
+++ b/examples/rust/upload-reflector/src/lib.rs
@@ -18,22 +18,18 @@ static mut TOTAL_RESPONSE_SENT: usize = 0;
static mut REQUEST_BUF: *mut u8 = null_mut();
#[no_mangle]
-pub extern "C" fn uwr_response_end_handler() {
- unsafe {
- TOTAL_RESPONSE_SENT = 0;
- }
+pub unsafe extern "C" fn uwr_response_end_handler() {
+ TOTAL_RESPONSE_SENT = 0;
}
#[no_mangle]
-pub extern "C" fn uwr_request_end_handler() {
- unsafe {
- if REQUEST_BUF.is_null() {
- return;
- }
-
- uwr_free(REQUEST_BUF);
- REQUEST_BUF = null_mut();
+pub unsafe extern "C" fn uwr_request_end_handler() {
+ if REQUEST_BUF.is_null() {
+ return;
}
+
+ uwr_free(REQUEST_BUF);
+ REQUEST_BUF = null_mut();
}
pub fn upload_reflector(ctx: *mut luw_ctx_t) -> i32 {