From 64ecd10486934c12336dac84c67a1939dce0e096 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 23 Aug 2020 10:16:12 +0100 Subject: 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. --- libbb/executable.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'libbb/executable.c') 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) n = strchr(p, PATH_SEP); if (n) *n = '\0'; -#if ENABLE_PLATFORM_MINGW32 - p = auto_add_system_drive(p); -#endif p = concat_path_file( p[0] ? p : ".", /* handle "::" case */ filename ); if (n) *n++ = PATH_SEP; #if ENABLE_PLATFORM_MINGW32 - if ((w=alloc_win32_extension(p))) { - free(p); - p = w; - /* following test will succeed */ - } + w = alloc_system_drive(p); + add_win32_extension(w); + free(p); + p = w; #endif ex = file_is_executable(p); if (ex) { -- cgit v1.2.3-55-g6feb