@@ -492,7 +492,7 @@ static mut REQUEST_BUF: *mut u8 = null_mut();
492492*/ ... */
493493#[no_mangle]
494494pub extern " C" fn uwr_request_handler (addr : * mut u8 ) -> i32 {
495- let ctx : * mut luw_ctx_t = unsafe { & mut CTX };
495+ let ctx : * mut luw_ctx_t = unsafe { addr_of_mut! ( CTX ) };
496496
497497 if unsafe { REQUEST_BUF . is_null () } {
498498 uwr_init_ctx (ctx , addr , 0 /* Response offset */ );
@@ -507,7 +507,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
507507 */
508508 uwr_set_req_buf (
509509 ctx ,
510- unsafe { & mut REQUEST_BUF },
510+ unsafe { addr_of_mut! ( REQUEST_BUF ) },
511511 LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE ,
512512 );
513513 } else {
@@ -811,7 +811,7 @@ Example
811811```Rust
812812#[no_mangle]
813813pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
814- let ctx: *mut luw_ctx_t = unsafe { &mut CTX };
814+ let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!( CTX) };
815815
816816 if unsafe { REQUEST_BUF.is_null() } {
817817 uwr_init_ctx(ctx, addr, 0 /* Response offset */ );
@@ -826,7 +826,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
826826 */
827827 uwr_set_req_buf(
828828 ctx,
829- unsafe { &mut REQUEST_BUF },
829+ unsafe { addr_of_mut!( REQUEST_BUF) },
830830 LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE,
831831 );
832832 } else {
@@ -868,14 +868,18 @@ Example
868868
869869```Rust
870870pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
871- let ctx: *mut luw_ctx_t = unsafe { &mut CTX };
871+ let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!( CTX) };
872872 let mut f;
873873 let bytes_wrote: isize;
874874 let mut total = unsafe { TOTAL_BYTES_WROTE };
875875
876876 if total == 0 {
877877 uwr_init_ctx(ctx, addr, 0);
878- uwr_set_req_buf(ctx, unsafe { &mut REQUEST_BUF }, LUW_SRB_NONE);
878+ uwr_set_req_buf(
879+ ctx,
880+ unsafe { addr_of_mut!(REQUEST_BUF) },
881+ LUW_SRB_NONE
882+ );
879883
880884 f = File::create("/var/tmp/large-file.dat").unwrap();
881885 } else {
0 commit comments