in printf, use ferror macro rather than directly inspecting flags bit

this is purely aesthetic and should not affect code generation or
functionality.
This commit is contained in:
Rich Felker 2023-03-20 19:16:21 -04:00
parent 868c964300
commit 0e5234807d

View File

@ -132,7 +132,7 @@ static void pop_arg(union arg *arg, int type, va_list *ap)
static void out(FILE *f, const char *s, size_t l) static void out(FILE *f, const char *s, size_t l)
{ {
if (!(f->flags & F_ERR)) __fwritex((void *)s, l, f); if (!ferror(f)) __fwritex((void *)s, l, f);
} }
static void pad(FILE *f, char c, int w, int l, int fl) static void pad(FILE *f, char c, int w, int l, int fl)
@ -693,7 +693,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
f->buf_size = 0; f->buf_size = 0;
f->wpos = f->wbase = f->wend = 0; f->wpos = f->wbase = f->wend = 0;
} }
if (f->flags & F_ERR) ret = -1; if (ferror(f)) ret = -1;
f->flags |= olderr; f->flags |= olderr;
FUNLOCK(f); FUNLOCK(f);
va_end(ap2); va_end(ap2);