From 844af06782c120e5529d531751c00bf0bc23aea7 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 24 Jan 2020 20:59:17 +0100 Subject: [PATCH] base/buffered_output.h: flush at destruction time By writing out all dangling characters at destruction time, the 'Buffered_output' utility can be used as a local variable rather than a long-living object. --- repos/base/include/base/buffered_output.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repos/base/include/base/buffered_output.h b/repos/base/include/base/buffered_output.h index 774a25180..713b92f40 100644 --- a/repos/base/include/base/buffered_output.h +++ b/repos/base/include/base/buffered_output.h @@ -52,6 +52,8 @@ class Genode::Buffered_output : public Output Buffered_output(BACKEND_WRITE_FN const &write_fn) : _write_fn(write_fn) { } + ~Buffered_output() { _flush(); } + void out_char(char c) override { /* ensure enough buffer space for complete escape sequence */