From 1b094d366f808a2ebc4824004f0d6f75f13c09cb Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 23 Jun 2024 09:06:19 +0100 Subject: win32: code shrink BB_CRITICAL_ERROR_DIALOGS Rewrite the test for the value of BB_CRITICAL_ERROR_DIALOGS. Saves 16-48 bytes. --- libbb/appletlib.c | 2 +- win32/mingw.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 121959376..54be59f2d 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -1352,7 +1352,7 @@ int main(int argc UNUSED_PARAM, char **argv) /* Have this process handle critical errors itself: the default * system-generated error dialogs may be inconvenient. */ - change_critical_error_dialogs(getenv(BB_CRITICAL_ERROR_DIALOGS) ?: ""); + change_critical_error_dialogs(getenv(BB_CRITICAL_ERROR_DIALOGS)); #endif #if defined(__MINGW64_VERSION_MAJOR) diff --git a/win32/mingw.c b/win32/mingw.c index 6ad514ad4..467e4a33d 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -2513,5 +2513,6 @@ windows_env(void) void FAST_FUNC change_critical_error_dialogs(const char *newval) { - SetErrorMode(strcmp(newval, "1") == 0 ? 0 : SEM_FAILCRITICALERRORS); + SetErrorMode(newval && newval[0] == '1' && newval[1] == '\0' ? + 0 : SEM_FAILCRITICALERRORS); } -- cgit v1.2.3-55-g6feb