From c5123e9482fff0b86b30bda74e94ae2d66ef01bf Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 28 Jan 2016 20:44:33 -0800 Subject: [PATCH] nasmlib.h: If BUFSIZ is bigger than the default ZERO_BUF_SIZE, adjust If BUFSIZ exists and is bigger than the default ZERO_BUF_SIZE, expand ZERO_BUF_SIZE so we don't end up unnecessarily double buffering in the stdio library. Signed-off-by: H. Peter Anvin --- nasmlib.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nasmlib.h b/nasmlib.h index 9cd417f1..e8526ab4 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2009 The NASM Authors - All Rights Reserved + * Copyright 1996-2016 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -409,7 +409,10 @@ char *nasm_realpath(const char *rel_path); const char *prefix_name(int); -#define ZERO_BUF_SIZE 4096 +#define ZERO_BUF_SIZE 4096 /* Default value */ +#if defined(BUFSIZ) && (BUFSIZ > ZERO_BUF_SIZE) +# define ZERO_BUF_SIZE BUFSIZ +#endif extern const uint8_t zero_buffer[ZERO_BUF_SIZE]; void fwritezero(size_t bytes, FILE *fp); -- 2.11.4.GIT