1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 20:47:46 +00:00

Merge pull request #6949 from alexs-sh/feature-seq-reduce-memory-allocation-during-prefix-search

seq:reduce memory allocation during prefix search
This commit is contained in:
Daniel Hofstetter 2024-12-11 16:22:20 +01:00 committed by GitHub
commit 7025620639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -341,7 +341,7 @@ impl FromStr for PreciseNumber {
// Check if the string seems to be in hexadecimal format. // Check if the string seems to be in hexadecimal format.
// //
// May be 0x123 or -0x123, so the index `i` may be either 0 or 1. // May be 0x123 or -0x123, so the index `i` may be either 0 or 1.
if let Some(i) = s.to_lowercase().find("0x") { if let Some(i) = s.find("0x").or_else(|| s.find("0X")) {
if i <= 1 { if i <= 1 {
return parse_hexadecimal(s); return parse_hexadecimal(s);
} }