Commit a1942184 authored by Andrei Alexandrescu's avatar Andrei Alexandrescu Committed by Viswanath Sivakumar

Mini-refactoring prompted by https://phabricator.fb.com/D1770460

Summary: I got obliged into this one :o).

Test Plan: runtests

Reviewed By: meyering@fb.com

Subscribers: njormrod, folly-diffs@

FB internal diff: D1772328

Signature: t1:1772328:1420744114:2b81e46d77800d247293cb667bbef86e9d6d4755
parent 2ab6db1e
...@@ -2322,16 +2322,15 @@ std::basic_istream< ...@@ -2322,16 +2322,15 @@ std::basic_istream<
n = str.max_size(); n = str.max_size();
} }
str.erase(); str.erase();
auto got = is.rdbuf()->sgetc(); for (auto got = is.rdbuf()->sgetc(); extracted != size_t(n); ++extracted) {
for (; extracted != size_t(n) && got != T::eof() &&
!isspace(got); ++extracted) {
// Whew. We get to store this guy
str.push_back(got);
got = is.rdbuf()->snextc();
}
if (got == T::eof()) { if (got == T::eof()) {
err |= __ios_base::eofbit; err |= __ios_base::eofbit;
is.width(0); is.width(0);
break;
}
if (isspace(got)) break;
str.push_back(got);
got = is.rdbuf()->snextc();
} }
} }
if (!extracted) { if (!extracted) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment