diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-11-28 11:30:51 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-11-28 11:33:18 -0500 |
commit | 4a5f626c3729eecf4a01c9cfc6e3392548263864 (patch) | |
tree | 627306d220635d72b2b0e1425098c74688aa978f /color.h | |
parent | 098aca8fe945d5c220ce5bfaa5020972e0f685c1 (diff) | |
download | bfs-4a5f626c3729eecf4a01c9cfc6e3392548263864.tar.xz |
color: Add an intermediate buffer
cfprintf() on an unbuffered file like stderr was causing a lot of
write() calls since every format specifier resulted in a separate
fwrite(). This led to inefficiency and bad interleaving. Add our own
dstring buffer to smooth it out.
Diffstat (limited to 'color.h')
-rw-r--r-- | color.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -56,6 +56,8 @@ typedef struct CFILE { FILE *file; /** The color table to use, if any. */ const struct colors *colors; + /** A buffer for colored formatting. */ + char *buffer; /** Whether to close the underlying stream. */ bool close; } CFILE; |