Log console: flush sooner rather than later

This commit is contained in:
Alexandre Bique 2012-02-15 06:18:27 +01:00 committed by Norman Feske
parent 06f155a644
commit a3266f8ec7
1 changed files with 2 additions and 4 deletions

View File

@ -44,16 +44,14 @@ class Log_console : public Console
void _out_char(char c)
{
/* flush full buffer */
if (_num_chars >= sizeof(_buf) - 1) _flush();
/* ensure enough buffer space for complete escape sequence */
if ((c == 27) && (_num_chars + 8 > _BUF_SIZE)) _flush();
_buf[_num_chars++] = c;
/* flush immediately on line break */
if (c == '\n') _flush();
if (c == '\n' || _num_chars >= sizeof(_buf) - 1)
_flush();
}
public: