File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
348348 if !full_version_line. trim ( ) . is_empty ( ) => {
349349 let full_version_line = full_version_line. trim ( ) ;
350350
351- // used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$ )"
351+ // used to be a regex "(^|[^0-9])([0-9]\.[0-9]+ )"
352352 for ( pos, c) in full_version_line. char_indices ( ) {
353353 if !c. is_digit ( 10 ) { continue }
354354 if pos + 2 >= full_version_line. len ( ) { continue }
@@ -357,11 +357,12 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
357357 if pos > 0 && full_version_line. char_at_reverse ( pos) . is_digit ( 10 ) {
358358 continue
359359 }
360- if pos + 3 < full_version_line. len ( ) &&
361- full_version_line. char_at ( pos + 3 ) . is_digit ( 10 ) {
362- continue
360+ let mut end = pos + 3 ;
361+ while end < full_version_line. len ( ) &&
362+ full_version_line. char_at ( end) . is_digit ( 10 ) {
363+ end += 1 ;
363364 }
364- return Some ( full_version_line[ pos..pos+ 3 ] . to_owned ( ) ) ;
365+ return Some ( full_version_line[ pos..end ] . to_owned ( ) ) ;
365366 }
366367 println ! ( "Could not extract GDB version from line '{}'" ,
367368 full_version_line) ;
You can’t perform that action at this time.
0 commit comments