Skip to content

Commit 4efcd35

Browse files
Abseil Teamcopybara-github
authored andcommitted
Pico-optimize SkipWhitespace to use StripLeadingAsciiWhitespace.
The `SkipWhitespace` predicate in `absl::StrSplit` now uses `absl::StripLeadingAsciiWhitespace` instead of `absl::StripAsciiWhitespace`. Since the predicate only checks if the string is empty after stripping, and both functions reduce strings consisting only of whitespace to empty, this change does not alter the filtering behavior of `SkipWhitespace`, but spares one redundant call to `absl::StripTrailingAsciiWhitespace`. PiperOrigin-RevId: 832467122 Change-Id: I5bf1ed99ded039d7070111d2f0cb50bc8b3d701a
1 parent f751e61 commit 4efcd35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

absl/strings/str_split.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ struct SkipEmpty {
382382
// // v[0] == " a ", v[1] == " ", v[2] == "b"
383383
struct SkipWhitespace {
384384
bool operator()(absl::string_view sp) const {
385-
sp = absl::StripAsciiWhitespace(sp);
385+
sp = absl::StripLeadingAsciiWhitespace(sp);
386386
return !sp.empty();
387387
}
388388
};

0 commit comments

Comments
 (0)