aboutsummaryrefslogtreecommitdiff
path: root/debianutils/which.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-02-13 11:44:28 +0000
committerRon Yorston <rmy@pobox.com>2020-02-13 11:44:28 +0000
commitf21cc9e93a6132d0471441569adfa86197f79ead (patch)
tree6c9118aa975d254bb8063ec8eb3f8c7717a330d1 /debianutils/which.c
parentbeba51059500737e6c004d7a8b0d196278115860 (diff)
downloadbusybox-w32-f21cc9e93a6132d0471441569adfa86197f79ead.tar.gz
busybox-w32-f21cc9e93a6132d0471441569adfa86197f79ead.tar.bz2
busybox-w32-f21cc9e93a6132d0471441569adfa86197f79ead.zip
win32: code shrink
Have bs_to_slash() return a pointer to its argument. This allows some calls to be chained, saving 32 bytes.
Diffstat (limited to 'debianutils/which.c')
-rw-r--r--debianutils/which.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index 61f5770c5..715bd8d5e 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -69,17 +69,14 @@ int which_main(int argc UNUSED_PARAM, char **argv)
69#if ENABLE_PLATFORM_MINGW32 69#if ENABLE_PLATFORM_MINGW32
70 if ((p=auto_win32_extension(*argv)) != NULL) { 70 if ((p=auto_win32_extension(*argv)) != NULL) {
71 missing = 0; 71 missing = 0;
72 bs_to_slash(p); 72 puts(bs_to_slash(p));
73 puts(p);
74 } 73 }
75 else 74 else
76#endif 75#endif
77 if (file_is_executable(*argv)) { 76 if (file_is_executable(*argv)) {
78 missing = 0; 77 missing = 0;
79#if ENABLE_PLATFORM_MINGW32 78#if ENABLE_PLATFORM_MINGW32
80 p = auto_string(xstrdup(*argv)); 79 puts(bs_to_slash(auto_string(xstrdup(*argv))));
81 bs_to_slash(p);
82 puts(p);
83#else 80#else
84 puts(*argv); 81 puts(*argv);
85#endif 82#endif
@@ -92,9 +89,10 @@ int which_main(int argc UNUSED_PARAM, char **argv)
92 while ((p = find_executable(*argv, &path)) != NULL) { 89 while ((p = find_executable(*argv, &path)) != NULL) {
93 missing = 0; 90 missing = 0;
94#if ENABLE_PLATFORM_MINGW32 91#if ENABLE_PLATFORM_MINGW32
95 bs_to_slash(p); 92 puts(bs_to_slash(p));
96#endif 93#else
97 puts(p); 94 puts(p);
95#endif
98 free(p); 96 free(p);
99 if (!option_mask32) /* -a not set */ 97 if (!option_mask32) /* -a not set */
100 break; 98 break;