aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-03-16 10:47:09 +0000
committerRon Yorston <rmy@pobox.com>2023-03-16 10:47:09 +0000
commit184edf9bd672bc93856157098d528eab48948ba9 (patch)
tree183531c00207b293de9a609384e0ef9ff7dbfac5 /include
parent385decd6bf62c116565ece1e0992ff7a79d48474 (diff)
downloadbusybox-w32-184edf9bd672bc93856157098d528eab48948ba9.tar.gz
busybox-w32-184edf9bd672bc93856157098d528eab48948ba9.tar.bz2
busybox-w32-184edf9bd672bc93856157098d528eab48948ba9.zip
win32: code shrink detection of executables
Add a function, file_is_win32_exe(), to detect if a path refers to an executable. It tries adding extensions if necessary. Use this in a number of places to replace common code of the form path = alloc_ext_space(cmd); if (add_win32_extension(path) || file_is_executable(path)) Saves 32-48 bytes.
Diffstat (limited to 'include')
-rw-r--r--include/mingw.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h
index e49483307..7e6109f2e 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -559,7 +559,9 @@ void init_codepage(void);
559int has_bat_suffix(const char *p); 559int has_bat_suffix(const char *p);
560int has_exe_suffix(const char *p); 560int has_exe_suffix(const char *p);
561int has_exe_suffix_or_dot(const char *name); 561int has_exe_suffix_or_dot(const char *name);
562char *alloc_ext_space(const char *path);
562int add_win32_extension(char *p); 563int add_win32_extension(char *p);
564char *file_is_win32_exe(const char *name);
563 565
564char *bs_to_slash(char *p) FAST_FUNC; 566char *bs_to_slash(char *p) FAST_FUNC;
565void slash_to_bs(char *p) FAST_FUNC; 567void slash_to_bs(char *p) FAST_FUNC;
@@ -578,7 +580,6 @@ int unc_root_len(const char *dir);
578int root_len(const char *path); 580int root_len(const char *path);
579const char *get_system_drive(void); 581const char *get_system_drive(void);
580const char *need_system_drive(const char *path); 582const char *need_system_drive(const char *path);
581char *alloc_ext_space(const char *path);
582int chdir_system_drive(void); 583int chdir_system_drive(void);
583char *xabsolute_path(char *path); 584char *xabsolute_path(char *path);
584char *get_drive_cwd(const char *path, char *buffer, int size); 585char *get_drive_cwd(const char *path, char *buffer, int size);