summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-01-28 20:44:33 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-01-28 20:44:33 -0800
commitc5123e9482fff0b86b30bda74e94ae2d66ef01bf (patch)
treee4905ec69c90484db71d82291f09aad1b8da9e1d
parent02237cbfe8056e48355f97f847ab4b063ffe0b7f (diff)
downloadnasm-c5123e9482fff0b86b30bda74e94ae2d66ef01bf.tar.gz
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 <hpa@zytor.com>
-rw-r--r--nasmlib.h7
1 files 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);