diff options
author | Ron Yorston <rmy@pobox.com> | 2021-07-28 12:48:21 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-07-28 12:48:21 +0100 |
commit | 83b78af8033e10e959e7b56c74b1c3c5ee2f8fc5 (patch) | |
tree | dbbb2b8f04260d7874a255f7b1a213055be5c62c /shell | |
parent | 5776a5f8d5bfe83b72dc3d9788e92a2a11b22cd2 (diff) | |
download | busybox-w32-83b78af8033e10e959e7b56c74b1c3c5ee2f8fc5.tar.gz busybox-w32-83b78af8033e10e959e7b56c74b1c3c5ee2f8fc5.tar.bz2 busybox-w32-83b78af8033e10e959e7b56c74b1c3c5ee2f8fc5.zip |
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.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 8 |
1 files changed, 4 insertions, 4 deletions
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) | |||
15269 | * because it appears first. | 15269 | * because it appears first. |
15270 | */ | 15270 | */ |
15271 | for (envp = environ; envp && *envp; envp++) { | 15271 | for (envp = environ; envp && *envp; envp++) { |
15272 | if (strncasecmp(*envp, "PATH=", 5) == 0 && | 15272 | if (is_prefixed_with_case(*envp, "PATH=") && |
15273 | strncmp(*envp, "PATH=", 5) != 0) { | 15273 | !is_prefixed_with(*envp, "PATH=")) { |
15274 | break; | 15274 | break; |
15275 | } | 15275 | } |
15276 | } | 15276 | } |
@@ -15295,8 +15295,8 @@ init(void) | |||
15295 | /* Convert backslashes to forward slashes in value but | 15295 | /* Convert backslashes to forward slashes in value but |
15296 | * not if we're on Windows XP or for variables known to | 15296 | * not if we're on Windows XP or for variables known to |
15297 | * cause problems */ | 15297 | * cause problems */ |
15298 | if ( !winxp && strncmp(*envp, "SYSTEMROOT=", 11) != 0 && | 15298 | if (!winxp && !is_prefixed_with(*envp, "SYSTEMROOT=") && |
15299 | strncmp(*envp, "COMSPEC=", 8) != 0 ) { | 15299 | !is_prefixed_with(*envp, "COMSPEC=")) { |
15300 | bs_to_slash(end+1); | 15300 | bs_to_slash(end+1); |
15301 | } | 15301 | } |
15302 | 15302 | ||