gout

A static git page generator
git clone https://git.bracken.jp/gout.git
Log | Files | Refs | README | LICENSE

commit 2c9fd2f76fb2b35d4ad595764d9eb7ef1668b5f9
parent 0845a1a6f76997c0577c9828110b8f8952e1e80d
Author: Chris Bracken <chris@bracken.jp>
Date:   Sat, 21 Feb 2026 00:13:27 +0900

format: print directly to out stream via fprintf

Previously we were writing to a buffer then writing that to the output
stream, but we can do it directly just as well.

Diffstat:
Msrc/format.c | 9++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/format.c b/src/format.c @@ -37,13 +37,8 @@ void print_time(FILE* out, time_t time, int timezone_offset) { int abs_offset = abs(timezone_offset); int timezone_hours = abs_offset / 60; int timezone_mins = abs_offset % 60; - char out_str[64]; - int r = snprintf(out_str, sizeof(out_str), "%s %c%02d%02d", formatted_time, - timezone_sign, timezone_hours, timezone_mins); - if (r < 0 || (size_t)r >= sizeof(out_str)) { - errx(1, "snprintf: time string truncated or error"); - } - fprintf(out, "%s", out_str); + fprintf(out, "%s %c%02d%02d", formatted_time, timezone_sign, timezone_hours, + timezone_mins); } void print_time_z(FILE* out, time_t time) {