diff options
author | Ron Yorston <rmy@pobox.com> | 2020-08-13 11:36:29 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-08-13 14:58:01 +0100 |
commit | 258ad6a1d52f1811f9de1d6b976f3797f5b31a2b (patch) | |
tree | e195bfa9eccb187e3e83ef797f516a92b539787e /shell | |
parent | 5a48290d9bdb827657114c24aa75c67bb1bd0ea7 (diff) | |
download | busybox-w32-258ad6a1d52f1811f9de1d6b976f3797f5b31a2b.tar.gz busybox-w32-258ad6a1d52f1811f9de1d6b976f3797f5b31a2b.tar.bz2 busybox-w32-258ad6a1d52f1811f9de1d6b976f3797f5b31a2b.zip |
win32: code shrink
Add a new function, has_path(), to detect that an executable name
doesn't require a path look-up.
Also, since is_absolute_path() is now only used in shell/ash.c move
its definition there from include/mingw.h.
Saves 128 bytes.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index d35ae027f..db7b18957 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -322,6 +322,8 @@ typedef long arith_t; | |||
322 | 322 | ||
323 | #if !ENABLE_PLATFORM_MINGW32 | 323 | #if !ENABLE_PLATFORM_MINGW32 |
324 | # define is_absolute_path(path) ((path)[0] == '/') | 324 | # define is_absolute_path(path) ((path)[0] == '/') |
325 | #else | ||
326 | # define is_absolute_path(path) ((path)[0] == '/' || (path)[0] == '\\' || has_dos_drive_prefix(path)) | ||
325 | #endif | 327 | #endif |
326 | 328 | ||
327 | #if !BB_MMU | 329 | #if !BB_MMU |
@@ -8729,9 +8731,10 @@ static void shellexec(char *prog, char **argv, const char *path, int idx) | |||
8729 | int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */ | 8731 | int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */ |
8730 | 8732 | ||
8731 | envp = listvars(VEXPORT, VUNSET, /*strlist:*/ NULL, /*end:*/ NULL); | 8733 | envp = listvars(VEXPORT, VUNSET, /*strlist:*/ NULL, /*end:*/ NULL); |
8734 | #if !ENABLE_PLATFORM_MINGW32 | ||
8732 | if (strchr(prog, '/') != NULL | 8735 | if (strchr(prog, '/') != NULL |
8733 | #if ENABLE_PLATFORM_MINGW32 | 8736 | #else |
8734 | || strchr(prog, '\\') != NULL || has_dos_drive_prefix(prog) | 8737 | if (has_path(prog) |
8735 | #endif | 8738 | #endif |
8736 | #if ENABLE_FEATURE_SH_STANDALONE | 8739 | #if ENABLE_FEATURE_SH_STANDALONE |
8737 | || (applet_no = find_applet_by_name(prog)) >= 0 | 8740 | || (applet_no = find_applet_by_name(prog)) >= 0 |
@@ -14242,7 +14245,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
14242 | 14245 | ||
14243 | /* If name contains a slash, don't use PATH or hash table */ | 14246 | /* If name contains a slash, don't use PATH or hash table */ |
14244 | #if ENABLE_PLATFORM_MINGW32 | 14247 | #if ENABLE_PLATFORM_MINGW32 |
14245 | if (strchr(name, '/') || strchr(name, '\\') || has_dos_drive_prefix(name)) { | 14248 | if (has_path(name)) { |
14246 | #else | 14249 | #else |
14247 | if (strchr(name, '/') != NULL) { | 14250 | if (strchr(name, '/') != NULL) { |
14248 | #endif | 14251 | #endif |