File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -189,9 +189,10 @@ ffi_fn! {
189189 } ;
190190 builder = builder. path_and_query( path_and_query_bytes) ;
191191 }
192+ let req = non_null!( & mut * req ?= hyper_code:: HYPERE_INVALID_ARG ) ;
192193 match builder. build( ) {
193194 Ok ( u) => {
194- * unsafe { & mut * req } . 0 . uri_mut( ) = u;
195+ * req. 0 . uri_mut( ) = u;
195196 hyper_code:: HYPERE_OK
196197 } ,
197198 Err ( _) => {
@@ -232,7 +233,8 @@ ffi_fn! {
232233 /// This is not an owned reference, so it should not be accessed after the
233234 /// `hyper_request` has been consumed.
234235 fn hyper_request_headers( req: * mut hyper_request) -> * mut hyper_headers {
235- hyper_headers:: get_or_default( unsafe { & mut * req } . 0 . extensions_mut( ) )
236+ let req = non_null!( & mut * req ?= std:: ptr:: null_mut( ) ) ;
237+ hyper_headers:: get_or_default( req. 0 . extensions_mut( ) )
236238 } ?= std:: ptr:: null_mut( )
237239}
238240
@@ -367,7 +369,8 @@ ffi_fn! {
367369 /// This is not an owned reference, so it should not be accessed after the
368370 /// `hyper_response` has been freed.
369371 fn hyper_response_headers( resp: * mut hyper_response) -> * mut hyper_headers {
370- hyper_headers:: get_or_default( unsafe { & mut * resp } . 0 . extensions_mut( ) )
372+ let resp = non_null!( & mut * resp ?= std:: ptr:: null_mut( ) ) ;
373+ hyper_headers:: get_or_default( resp. 0 . extensions_mut( ) )
371374 } ?= std:: ptr:: null_mut( )
372375}
373376
You can’t perform that action at this time.
0 commit comments