aboutsummaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2018-06-15 18:20:17 -0700
committerH. Peter Anvin <hpa@zytor.com>2018-06-15 18:20:17 -0700
commitc51369067ce7cfac43d8bc8681a3c916d8d5e503 (patch)
tree185bbd5df654b0e0c61c84aa2da144f18406e5f3 /stdlib
parentd3b1832c049c533656fd1945440d637f01a0f1a4 (diff)
downloadnasm-c51369067ce7cfac43d8bc8681a3c916d8d5e503.tar.gz
nasm-c51369067ce7cfac43d8bc8681a3c916d8d5e503.tar.xz
nasm-c51369067ce7cfac43d8bc8681a3c916d8d5e503.zip
errors: simplify nasm_fatal() and nasm_panic()
Nearly all instances of nasm_fatal() and nasm_panic() take a flags argument of zero. Simplify the code by making nasm_fatal and nasm_panic default to no flags, and add an alternate version if flags really are desired. This also means that every call site doesn't have to initialize a zero argument. Furthermore, ERR_NOFILE is now often not necessary, as the error code will no longer cause a null reference if there is no current file. Therefore, we can remove many instances of ERR_NOFILE which only deprives the user of information. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/vsnprintf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/stdlib/vsnprintf.c b/stdlib/vsnprintf.c
index 5a600fc7..ea83921c 100644
--- a/stdlib/vsnprintf.c
+++ b/stdlib/vsnprintf.c
@@ -26,15 +26,14 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap)
int rv, bytes;
if (size > BUFFER_SIZE) {
- nasm_panic(ERR_NOFILE,
- "vsnprintf: size (%d) > BUFFER_SIZE (%d)",
+ nasm_panic("vsnprintf: size (%d) > BUFFER_SIZE (%d)",
size, BUFFER_SIZE);
size = BUFFER_SIZE;
}
rv = vsprintf(snprintf_buffer, format, ap);
if (rv >= BUFFER_SIZE)
- nasm_panic(ERR_NOFILE, "vsnprintf buffer overflow");
+ nasm_panic("vsnprintf buffer overflow");
if (size > 0) {
if ((size_t)rv < size-1)