diff options
| author | Ron Yorston <rmy@pobox.com> | 2018-11-25 21:29:32 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2018-11-26 09:43:28 +0000 |
| commit | 0856f3a689a26c88ff68f250c7ba2d7be7940fbe (patch) | |
| tree | d2f3cde7205ee1488d87d301cb28a9425a1eae5a | |
| parent | 1ae73ffecfa074e345c75dc761931a767c9c9318 (diff) | |
| download | busybox-w32-0856f3a689a26c88ff68f250c7ba2d7be7940fbe.tar.gz busybox-w32-0856f3a689a26c88ff68f250c7ba2d7be7940fbe.tar.bz2 busybox-w32-0856f3a689a26c88ff68f250c7ba2d7be7940fbe.zip | |
win32: move function redefinitions to mingw.h
The itoa and strrev functions have different prototypes in BusyBox
and WIN32. Move the #defines which handle this to mingw.h, reducing
differences between busybox-w32 and upstream.
| -rw-r--r-- | include/libbb.h | 3 | ||||
| -rw-r--r-- | include/mingw.h | 6 | ||||
| -rw-r--r-- | util-linux/rev.c | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/include/libbb.h b/include/libbb.h index 0a333dca8..90fdd1178 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -1010,9 +1010,6 @@ char *safe_gethostname(void) FAST_FUNC; | |||
| 1010 | char* str_tolower(char *str) FAST_FUNC; | 1010 | char* str_tolower(char *str) FAST_FUNC; |
| 1011 | 1011 | ||
| 1012 | char *utoa(unsigned n) FAST_FUNC; | 1012 | char *utoa(unsigned n) FAST_FUNC; |
| 1013 | #if ENABLE_PLATFORM_MINGW32 | ||
| 1014 | # define itoa bb_itoa | ||
| 1015 | #endif | ||
| 1016 | char *itoa(int n) FAST_FUNC; | 1013 | char *itoa(int n) FAST_FUNC; |
| 1017 | /* Returns a pointer past the formatted number, does NOT null-terminate */ | 1014 | /* Returns a pointer past the formatted number, does NOT null-terminate */ |
| 1018 | char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; | 1015 | char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; |
diff --git a/include/mingw.h b/include/mingw.h index 7ee9c15cc..025c4e22b 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
| @@ -419,6 +419,12 @@ DIR *mingw_opendir(const char *path); | |||
| 419 | #define opendir mingw_opendir | 419 | #define opendir mingw_opendir |
| 420 | 420 | ||
| 421 | /* | 421 | /* |
| 422 | * Functions with different prototypes in BusyBox and WIN32 | ||
| 423 | */ | ||
| 424 | #define itoa bb_itoa | ||
| 425 | #define strrev bb_strrev | ||
| 426 | |||
| 427 | /* | ||
| 422 | * MinGW specific | 428 | * MinGW specific |
| 423 | */ | 429 | */ |
| 424 | #define is_dir_sep(c) ((c) == '/' || (c) == '\\') | 430 | #define is_dir_sep(c) ((c) == '/' || (c) == '\\') |
diff --git a/util-linux/rev.c b/util-linux/rev.c index b0a0c01aa..c90b4bbaf 100644 --- a/util-linux/rev.c +++ b/util-linux/rev.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | /* In-place invert */ | 33 | /* In-place invert */ |
| 34 | static void bb_strrev(CHAR_T *s, int len) | 34 | static void strrev(CHAR_T *s, int len) |
| 35 | { | 35 | { |
| 36 | int i; | 36 | int i; |
| 37 | 37 | ||
| @@ -103,14 +103,14 @@ int rev_main(int argc UNUSED_PARAM, char **argv) | |||
| 103 | /* Convert to wchar_t (might error out!) */ | 103 | /* Convert to wchar_t (might error out!) */ |
| 104 | int len = mbstowcs(tmp, buf, bufsize); | 104 | int len = mbstowcs(tmp, buf, bufsize); |
| 105 | if (len >= 0) { | 105 | if (len >= 0) { |
| 106 | bb_strrev(tmp, len); | 106 | strrev(tmp, len); |
| 107 | /* Convert back to char */ | 107 | /* Convert back to char */ |
| 108 | wcstombs(buf, tmp, bufsize); | 108 | wcstombs(buf, tmp, bufsize); |
| 109 | } | 109 | } |
| 110 | free(tmp); | 110 | free(tmp); |
| 111 | } | 111 | } |
| 112 | #else | 112 | #else |
| 113 | bb_strrev(buf, strlen(buf)); | 113 | strrev(buf, strlen(buf)); |
| 114 | #endif | 114 | #endif |
| 115 | fputs(buf, stdout); | 115 | fputs(buf, stdout); |
| 116 | } | 116 | } |
