File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -490,11 +490,13 @@ fn write_fast<R: FdReadable>(handle: &mut InputHandle<R>) -> CatResult<()> {
490490 }
491491 // If we're not on Linux or Android, or the splice() call failed,
492492 // fall back on slower writing.
493+ write_slow ( handle, stdout)
494+ }
495+
496+ #[ cfg_attr( any( target_os = "linux" , target_os = "android" ) , inline( never) ) ] // splice fast-path does not require this allocation
497+ #[ cfg_attr( not( any( target_os = "linux" , target_os = "android" ) ) , inline) ]
498+ fn write_slow < R : FdReadable > ( handle : & mut InputHandle < R > , stdout : io:: Stdout ) -> CatResult < ( ) > {
493499 let mut stdout_lock = stdout. lock ( ) ;
494- // stack allocation is overhead when splice succeed
495- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
496- let mut buf = vec ! [ 0 ; 1024 * 64 ] ;
497- #[ cfg( not( any( target_os = "linux" , target_os = "android" ) ) ) ]
498500 let mut buf = [ 0 ; 1024 * 64 ] ;
499501 loop {
500502 match handle. reader . read ( & mut buf) {
You can’t perform that action at this time.
0 commit comments