From 83b78af8033e10e959e7b56c74b1c3c5ee2f8fc5 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 28 Jul 2021 12:48:21 +0100 Subject: win32: code shrink using is_prefixed_with() Use is_prefixed_with() rather than strncmp() in a few places, and the case-insensitive analogues. Saves 96 bytes in 64-bit build, 192 bytes in 32-bit. --- shell/ash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 3e02a4e1f..08e34d6e7 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -15269,8 +15269,8 @@ init(void) * because it appears first. */ for (envp = environ; envp && *envp; envp++) { - if (strncasecmp(*envp, "PATH=", 5) == 0 && - strncmp(*envp, "PATH=", 5) != 0) { + if (is_prefixed_with_case(*envp, "PATH=") && + !is_prefixed_with(*envp, "PATH=")) { break; } } @@ -15295,8 +15295,8 @@ init(void) /* Convert backslashes to forward slashes in value but * not if we're on Windows XP or for variables known to * cause problems */ - if ( !winxp && strncmp(*envp, "SYSTEMROOT=", 11) != 0 && - strncmp(*envp, "COMSPEC=", 8) != 0 ) { + if (!winxp && !is_prefixed_with(*envp, "SYSTEMROOT=") && + !is_prefixed_with(*envp, "COMSPEC=")) { bs_to_slash(end+1); } -- cgit v1.2.3-55-g6feb