mod util;
mod stdio;
-const DEFAULT_BUF_SIZE: usize = 8 * 1024;
+const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
// A few methods below (read_to_string, read_line) will append data into a
// `String` buffer, but we need to be pretty careful when doing this. The
_ => Maybe::Fake
};
- // The default buffer capacity is 64k, but apparently windows
- // doesn't like 64k reads on stdin. See #13304 for details, but the
- // idea is that on windows we use a slightly smaller buffer that's
- // been seen to be acceptable.
- Arc::new(Mutex::new(if cfg!(windows) {
- BufReader::with_capacity(8 * 1024, stdin)
- } else {
- BufReader::new(stdin)
- }))
+ Arc::new(Mutex::new(BufReader::with_capacity(stdio::STDIN_BUF_SIZE, stdin)))
}
}
use io::Read;
use slice::from_raw_parts_mut;
+pub const DEFAULT_BUF_SIZE: usize = 8 * 1024;
+
// Provides read_to_end functionality over an uninitialized buffer.
// This function is unsafe because it calls the underlying
// read function with a slice into uninitialized memory. The default
}
pub const EBADF_ERR: i32 = ::libc::EBADF as i32;
+pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
}
pub const EBADF_ERR: i32 = ::sys::c::ERROR_INVALID_HANDLE as i32;
+// The default buffer capacity is 64k, but apparently windows
+// doesn't like 64k reads on stdin. See #13304 for details, but the
+// idea is that on windows we use a slightly smaller buffer that's
+// been seen to be acceptable.
+pub const STDIN_BUF_SIZE: usize = 8 * 1024;
"src/libstd/lib.rs", // This could probably be done within the sys directory
"src/libstd/rtdeps.rs", // Until rustbuild replaces make
"src/libstd/path.rs",
- "src/libstd/io/stdio.rs",
"src/libstd/num/f32.rs",
"src/libstd/num/f64.rs",
"src/libstd/sys/common/mod.rs",