summaryrefslogtreecommitdiffstats
path: root/color.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-11-28 11:30:51 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-11-28 11:33:18 -0500
commit4a5f626c3729eecf4a01c9cfc6e3392548263864 (patch)
tree627306d220635d72b2b0e1425098c74688aa978f /color.h
parent098aca8fe945d5c220ce5bfaa5020972e0f685c1 (diff)
downloadbfs-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.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/color.h b/color.h
index fabac13..55e89ff 100644
--- a/color.h
+++ b/color.h
@@ -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;