From: Dan Fandrich Date: Sat, 19 Jun 2010 05:37:42 +0000 (-0700) Subject: A few minor portability improvements X-Git-Tag: 1_17_0~63 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fdd7b566ecdc174907f38d9389b28ba842d2b4bf;p=oweals%2Fbusybox.git A few minor portability improvements Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- diff --git a/archival/libunarchive/unxz/xz_config.h b/archival/libunarchive/unxz/xz_config.h index ff90eff26..a4141e136 100644 --- a/archival/libunarchive/unxz/xz_config.h +++ b/archival/libunarchive/unxz/xz_config.h @@ -32,7 +32,9 @@ #define memeq(a, b, size) (memcmp(a, b, size) == 0) #define memzero(buf, size) memset(buf, 0, size) +#ifndef min #define min(x, y) ((x) < (y) ? (x) : (y)) +#endif #define min_t(type, x, y) min(x, y) /* diff --git a/include/platform.h b/include/platform.h index f87add552..4bd7a3d2e 100644 --- a/include/platform.h +++ b/include/platform.h @@ -168,10 +168,10 @@ #if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__ # define BB_BIG_ENDIAN 1 # define BB_LITTLE_ENDIAN 0 -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN # define BB_BIG_ENDIAN 1 # define BB_LITTLE_ENDIAN 0 -#elif __BYTE_ORDER == __LITTLE_ENDIAN +#elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__386__) # define BB_BIG_ENDIAN 0 # define BB_LITTLE_ENDIAN 1 #else diff --git a/libbb/xconnect.c b/libbb/xconnect.c index c3ee633e4..2de6de7c5 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c @@ -7,6 +7,7 @@ * Licensed under GPLv2, see file LICENSE in this tarball for details. */ +#include #include /* netinet/in.h needs it */ #include #include diff --git a/networking/ipcalc.c b/networking/ipcalc.c index 17b216354..87f31fdb5 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -12,11 +12,11 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ +#include "libbb.h" + #include #include -#include "libbb.h" - #define CLASS_A_NETMASK ntohl(0xFF000000) #define CLASS_B_NETMASK ntohl(0xFFFF0000) #define CLASS_C_NETMASK ntohl(0xFFFFFF00) diff --git a/shell/hush.c b/shell/hush.c index 4832e2c48..e64c923b4 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1217,7 +1217,7 @@ static void hush_exit(int exitcode) static int check_and_run_traps(int sig) { - static const struct timespec zero_timespec = { 0, 0 }; + static const struct timespec zero_timespec; smalluint save_rcode; int last_sig = 0;