diff options
author | Ron Yorston <rmy@pobox.com> | 2020-08-23 10:16:12 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-08-23 10:16:12 +0100 |
commit | 64ecd10486934c12336dac84c67a1939dce0e096 (patch) | |
tree | 73e8bc6b07176b84295fd07f19828292a240f693 /libbb | |
parent | d6b557547551dd80a389f361a995a97ef5930a63 (diff) | |
download | busybox-w32-64ecd10486934c12336dac84c67a1939dce0e096.tar.gz busybox-w32-64ecd10486934c12336dac84c67a1939dce0e096.tar.bz2 busybox-w32-64ecd10486934c12336dac84c67a1939dce0e096.zip |
win32: code shrink Unix-style path handling
Replace auto_add_system_drive() with alloc_system_drive() which
leaves space for a possible filename extension. This makes it
possible to drop alloc_win32_extension() and auto_win32_extension().
Saves 144 bytes.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/executable.c | 12 | ||||
-rw-r--r-- | libbb/lineedit.c | 3 |
2 files changed, 6 insertions, 9 deletions
diff --git a/libbb/executable.c b/libbb/executable.c index 0a0769ef3..f549a7aae 100644 --- a/libbb/executable.c +++ b/libbb/executable.c | |||
@@ -49,20 +49,16 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
49 | 49 | ||
50 | n = strchr(p, PATH_SEP); | 50 | n = strchr(p, PATH_SEP); |
51 | if (n) *n = '\0'; | 51 | if (n) *n = '\0'; |
52 | #if ENABLE_PLATFORM_MINGW32 | ||
53 | p = auto_add_system_drive(p); | ||
54 | #endif | ||
55 | p = concat_path_file( | 52 | p = concat_path_file( |
56 | p[0] ? p : ".", /* handle "::" case */ | 53 | p[0] ? p : ".", /* handle "::" case */ |
57 | filename | 54 | filename |
58 | ); | 55 | ); |
59 | if (n) *n++ = PATH_SEP; | 56 | if (n) *n++ = PATH_SEP; |
60 | #if ENABLE_PLATFORM_MINGW32 | 57 | #if ENABLE_PLATFORM_MINGW32 |
61 | if ((w=alloc_win32_extension(p))) { | 58 | w = alloc_system_drive(p); |
62 | free(p); | 59 | add_win32_extension(w); |
63 | p = w; | 60 | free(p); |
64 | /* following test will succeed */ | 61 | p = w; |
65 | } | ||
66 | #endif | 62 | #endif |
67 | ex = file_is_executable(p); | 63 | ex = file_is_executable(p); |
68 | if (ex) { | 64 | if (ex) { |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index f6577e372..b35da1874 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -913,8 +913,9 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type) | |||
913 | struct dirent *next; | 913 | struct dirent *next; |
914 | struct stat st; | 914 | struct stat st; |
915 | char *found; | 915 | char *found; |
916 | |||
916 | #if ENABLE_PLATFORM_MINGW32 | 917 | #if ENABLE_PLATFORM_MINGW32 |
917 | char *lpath = auto_add_system_drive(paths[i]); | 918 | char *lpath = auto_string(alloc_system_drive(paths[i])); |
918 | dir = opendir(lpath); | 919 | dir = opendir(lpath); |
919 | #else | 920 | #else |
920 | dir = opendir(paths[i]); | 921 | dir = opendir(paths[i]); |