File tree Expand file tree Collapse file tree 1 file changed +11
-16
lines changed
Expand file tree Collapse file tree 1 file changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -136,27 +136,22 @@ where
136136 self . total_size = end;
137137
138138 let mut ix = 0 ;
139+ let matcher = jetscii:: bytes!( b'\r' , b'\n' ) ;
139140
140- // TODO: jetscii.
141141 while ix < end {
142- let mut eol = ix;
143-
144- while eol < end {
145- match sb[ eol] {
146- b'\r' => {
147- eol += 1 ;
148- if eol < end && sb[ eol] == b'\n' {
149- eol += 1 ;
150- }
151- break ;
152- }
153- b'\n' => {
142+ let mut eol = match matcher. find ( & sb[ ix..] ) {
143+ Some ( offset) => ix + offset,
144+ None => end,
145+ } ;
146+ if eol < end {
147+ if sb[ eol] == b'\r' {
148+ eol += 1 ;
149+ if eol < end && sb[ eol] == b'\n' {
154150 eol += 1 ;
155- break ;
156151 }
157- _ => { }
152+ } else if sb[ eol] == b'\n' {
153+ eol += 1 ;
158154 }
159- eol += 1 ;
160155 }
161156
162157 self . process_line ( & s[ ix..eol] ) ;
You can’t perform that action at this time.
0 commit comments