From 0a51f5b8d9b3d98225382277a176fa85ccdb5ab8 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 23 Oct 2025 11:18:54 +0200 Subject: use libc's stdout/stderr; also eliminate some unnecessary recursion in bfmt --- common.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'common.h') diff --git a/common.h b/common.h index 6f01da0..9c9fd70 100644 --- a/common.h +++ b/common.h @@ -541,11 +541,17 @@ rsiter(int *i, uvlong rs) /********/ struct wbuf { - char *buf; - const uint cap; - uint len; - int fd; + union { + struct { + char *buf; + const uint cap; + uint len; + int fd; + }; + void *fp; + }; bool err; + bool isfp; }; /* read-only file mapping that is at least 1 page larger than the real file @@ -562,9 +568,10 @@ struct embedfile { size_t len; }; -#define MEMBUF(buf, cap) { (buf), (cap), .fd = -1 } -#define FDBUF(buf, cap, fd_) { (buf), (cap), .fd = (fd_) } +#define MEMBUF(buf_, cap_) { .buf = (buf_), .cap = (cap_), .fd = -1 } +#define FDBUF(buf_, cap_, fd_) { .buf = (buf_), .cap = (cap_), .fd = (fd_) } extern struct wbuf bstdout, bstderr; +void ioinit(void); void iowrite(struct wbuf *, const void *src, int n); void ioputc(struct wbuf *, uchar); void ioflush(struct wbuf *); -- cgit v1.2.3