Skip to content

Commit

Permalink
Avoid getline(s, EOF)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdunn2001 committed May 5, 2021
1 parent bb34617 commit ed1ab7a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib_json/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ bool Reader::parse(std::istream& is, Value& root, bool collectComments) {

// Since String is reference-counted, this at least does not
// create an extra copy.
String doc;
std::getline(is, doc, static_cast<char> EOF);
String doc(std::istreambuf_iterator<char>(is), {});
return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
}

Expand Down

0 comments on commit ed1ab7a

Please sign in to comment.