1
Fork 0

Implement check_stream nonrecursively

This commit is contained in:
David Tolnay 2022-01-18 19:19:18 -08:00
parent 947a09a4a8
commit 0490e43422
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -335,14 +335,14 @@ impl Printer {
}
fn check_stream(&mut self) {
if self.right_total - self.left_total > self.space {
while self.right_total - self.left_total > self.space {
if self.scan_stack.back() == Some(&self.left) {
self.scan_stack.pop_back().unwrap();
self.buf[self.left].size = SIZE_INFINITY;
}
self.advance_left();
if self.left != self.right {
self.check_stream();
if self.left == self.right {
break;
}
}
}