Clean up a few bits about discarding buffers

We weren't properly propagating the 'discarded' stuff from output
streams to buffers. Fix that.
This commit is contained in:
ridiculousfish 2020-01-24 16:08:56 -08:00
parent b99546e7a0
commit 4f205f38b4
2 changed files with 2 additions and 7 deletions

View File

@ -48,7 +48,7 @@ void io_bufferfill_t::print() const { std::fwprintf(stderr, L"bufferfill {%d}\n"
void io_buffer_t::append_from_stream(const output_stream_t &stream) {
const separated_buffer_t<wcstring> &input = stream.buffer();
if (input.elements().empty()) return;
if (input.elements().empty() && !input.discarded()) return;
scoped_lock locker(append_lock_);
if (buffer_.discarded()) return;
if (input.discarded()) {

View File

@ -117,8 +117,6 @@ class separated_buffer_t {
discard = true;
}
void reset_discard() { discard = false; }
/// Serialize the contents to a single string, where explicitly separated elements have a
/// newline appended.
StringType newline_serialized() const {
@ -322,10 +320,7 @@ class io_buffer_t {
bool fillthread_running() const { return fillthread_waiter_.valid(); }
public:
explicit io_buffer_t(size_t limit) : buffer_(limit) {
// Explicitly reset the discard flag because we share this buffer.
buffer_.reset_discard();
}
explicit io_buffer_t(size_t limit) : buffer_(limit) {}
~io_buffer_t();