From 4a5f626c3729eecf4a01c9cfc6e3392548263864 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 28 Nov 2020 11:30:51 -0500 Subject: 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. --- color.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'color.h') 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; -- cgit v1.2.3