@@ -122,7 +122,7 @@ fn build_display_str(args: &Args, count: &CountInfo, filename: &OsStr) -> String
122122 output
123123}
124124
125- fn wc_file_bytes ( count : & mut CountInfo , pathname : & PathBuf , table : & [ bool ; 256 ] , chars_mode : bool ) -> io:: Result < ( ) > {
125+ fn wc_file_bytes ( count : & mut CountInfo , pathname : & PathBuf , chars_mode : bool ) -> io:: Result < ( ) > {
126126 let mut file = plib:: io:: input_stream ( pathname, false ) ?;
127127
128128 let mut buffer = [ 0 ; plib:: BUFSZ ] ;
@@ -146,7 +146,7 @@ fn wc_file_bytes(count: &mut CountInfo, pathname: &PathBuf, table: &[bool; 256],
146146
147147
148148 for ch_u8 in bufslice {
149- let is_space = table [ * ch_u8 as usize ] ;
149+ let is_space = BYTE_TABLE [ * ch_u8 as usize ] ;
150150 count. nl += ( ch_u8 == & 10 ) as usize ;
151151 count. words += ( !is_space && was_space) as usize ;
152152 was_space = is_space;
@@ -161,9 +161,8 @@ fn wc_file(
161161 chars_mode : bool ,
162162 pathname : & PathBuf ,
163163 count : & mut CountInfo ,
164- table : & [ bool ; 256 ] ,
165164) -> io:: Result < ( ) > {
166- wc_file_bytes ( count, pathname, table , chars_mode) ?;
165+ wc_file_bytes ( count, pathname, chars_mode) ?;
167166
168167 let output = build_display_str ( args, count, pathname. as_os_str ( ) ) ;
169168
@@ -199,7 +198,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
199198 if args. files . is_empty ( ) {
200199 let mut count = CountInfo :: new ( ) ;
201200
202- if let Err ( e) = wc_file ( & args, chars_mode, & PathBuf :: new ( ) , & mut count, & BYTE_TABLE ) {
201+ if let Err ( e) = wc_file ( & args, chars_mode, & PathBuf :: new ( ) , & mut count) {
203202 exit_code = 1 ;
204203 eprintln ! ( "stdin: {}" , e) ;
205204 }
@@ -209,7 +208,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
209208 for filename in & args. files {
210209 let mut count = CountInfo :: new ( ) ;
211210
212- if let Err ( e) = wc_file ( & args, chars_mode, filename, & mut count, & BYTE_TABLE ) {
211+ if let Err ( e) = wc_file ( & args, chars_mode, filename, & mut count) {
213212 exit_code = 1 ;
214213 eprintln ! ( "{}: {}" , filename. display( ) , e) ;
215214 }
0 commit comments