Commit 59139941 authored by Max Kellermann's avatar Max Kellermann

lib/yajl/ParseInputStream: eliminate variable "done"

parent 26b1573c
...@@ -27,17 +27,14 @@ Yajl::ParseInputStream(Handle &handle, InputStream &is) ...@@ -27,17 +27,14 @@ Yajl::ParseInputStream(Handle &handle, InputStream &is)
{ {
const std::lock_guard<Mutex> protect(is.mutex); const std::lock_guard<Mutex> protect(is.mutex);
bool done = false; while (true) {
while (!done) {
unsigned char buffer[4096]; unsigned char buffer[4096];
const size_t nbytes = is.Read(buffer, sizeof(buffer)); const size_t nbytes = is.Read(buffer, sizeof(buffer));
if (nbytes == 0) if (nbytes == 0)
done = true; break;
if (done) { handle.Parse(buffer, nbytes);
handle.CompleteParse();
} else
handle.Parse(buffer, nbytes);
} }
handle.CompleteParse();
} }
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