From 0ed5e47abe441f5ed75d4c7ec253af9719c1c8db Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Wed, 1 Oct 2014 15:11:12 +0300 Subject: [PATCH] Prefix *_ENDIAN macros with RADIUS_ Rename LITTLE_ENDIAN and BIG_ENDIAN macros to RADIUS_LITTLE_ENDIAN and RADIUS_BIG_ENDIAN respectively to avoid clashes with /usr/include/endian.h defines, which result in always assuming little-endian architecture. --- configure | 4 ++-- configure.ac | 4 ++-- src/include/autoconf.h.in | 16 ++++++++-------- src/include/build.h | 6 +++--- src/include/missing-h | 4 ++-- src/lib/missing.c | 2 +- src/main/version.c | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/configure b/configure index f15072d..1b54efd 100755 --- a/configure +++ b/configure @@ -4771,11 +4771,11 @@ $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) -$as_echo "#define BIG_ENDIAN 1" >>confdefs.h +$as_echo "#define RADIUS_BIG_ENDIAN 1" >>confdefs.h ;; #( no) -$as_echo "#define LITTLE_ENDIAN 1" >>confdefs.h +$as_echo "#define RADIUS_LITTLE_ENDIAN 1" >>confdefs.h ;; #( universal) diff --git a/configure.ac b/configure.ac index 76466ec..30b226b 100644 --- a/configure.ac +++ b/configure.ac @@ -167,8 +167,8 @@ dnl # check for system bytesex dnl # AC_DEFINES WORDS_BIGENDIAN dnl # AC_C_BIGENDIAN( - [AC_DEFINE(BIG_ENDIAN, 1, [Define if your processor stores words with the most significant byte first])], - [AC_DEFINE(LITTLE_ENDIAN, 1, [Define if your processor stores words with the least significant byte first])] + [AC_DEFINE(RADIUS_BIG_ENDIAN, 1, [Define if your processor stores words with the most significant byte first])], + [AC_DEFINE(RADIUS_LITTLE_ENDIAN, 1, [Define if your processor stores words with the least significant byte first])] ) dnl # diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in index 6e6e355..c313bca 100644 --- a/src/include/autoconf.h.in +++ b/src/include/autoconf.h.in @@ -3,10 +3,6 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD -/* Define if your processor stores words with the most significant byte first - */ -#undef BIG_ENDIAN - /* BSD-Style get*byaddr_r */ #undef BSDSTYLE @@ -443,10 +439,6 @@ /* compiler specific 128 bit unsigned integer */ #undef HAVE___UINT128_T -/* Define if your processor stores words with the least significant byte first - */ -#undef LITTLE_ENDIAN - /* define if you have OSFC2 authentication */ #undef OSFC2 @@ -483,6 +475,14 @@ /* Raw version string from VERSION file */ #undef RADIUSD_VERSION_STRING +/* Define if your processor stores words with the most significant byte first + */ +#undef RADIUS_BIG_ENDIAN + +/* Define if your processor stores words with the least significant byte first + */ +#undef RADIUS_LITTLE_ENDIAN + /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE diff --git a/src/include/build.h b/src/include/build.h index 66c3087..4c1bf1a 100644 --- a/src/include/build.h +++ b/src/include/build.h @@ -105,13 +105,13 @@ extern "C" { * Here at least the endianess can be set explicitly with * -DLITTLE_ENDIAN or -DBIG_ENDIAN. */ -#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) +#if !defined(RADIUS_LITTLE_ENDIAN) && !defined(RADIUS_BIG_ENDIAN) # if defined(__LITTLE_ENDIAN__) || \ (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) -# define LITTLE_ENDIAN 1 +# define RADIUS_LITTLE_ENDIAN 1 # elif defined(__BIG_ENDIAN__) || \ (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) -# define BIG_ENDIAN 1 +# define RADIUS_BIG_ENDIAN 1 # else # error Failed determining endianness of system # endif diff --git a/src/include/missing-h b/src/include/missing-h index 3f286a4..7136172 100644 --- a/src/include/missing-h +++ b/src/include/missing-h @@ -424,7 +424,7 @@ typedef struct int128_t { uint8_t v[16]; } int128_t; /* abcd efgh -> dcba hgfe -> hgfe dcba */ #ifndef HAVE_HTON_LL -# ifdef LITTLE_ENDIAN +# ifdef RADIUS_LITTLE_ENDIAN # ifdef HAVE_BUILTIN_BSWAP64 # define ntohll(x) __builtin_bswap64(x) # else @@ -437,7 +437,7 @@ typedef struct int128_t { uint8_t v[16]; } int128_t; #endif #ifndef HAVE_HTON_LLL -# ifdef LITTLE_ENDIAN +# ifdef RADIUS_LITTLE_ENDIAN # ifdef HAVE_128BIT_INTEGERS # define ntohlll(x) (((uint128_t)ntohll((uint64_t)(x >> 64))) | (((uint128_t)ntohll(((uint64_t) x)) << 64))) # else diff --git a/src/lib/missing.c b/src/lib/missing.c index 4598c8f..efd5461 100644 --- a/src/lib/missing.c +++ b/src/lib/missing.c @@ -273,7 +273,7 @@ ntp2timeval(struct timeval *tv, char const *ntp) tv->tv_usec = usec / 4295; /* close enough */ } -#if !defined(HAVE_128BIT_INTEGERS) && defined(LITTLE_ENDIAN) +#if !defined(HAVE_128BIT_INTEGERS) && defined(RADIUS_LITTLE_ENDIAN) /** Swap byte order of 128 bit integer * * @param num 128bit integer to swap. diff --git a/src/main/version.c b/src/main/version.c index 0aba383..8b56ffa 100644 --- a/src/main/version.c +++ b/src/main/version.c @@ -276,9 +276,9 @@ void version(void) DEBUG3(" 0x%llx", (unsigned long long) libmagic); DEBUG3("Endianess:"); -#if defined(LITTLE_ENDIAN) +#if defined(RADIUS_LITTLE_ENDIAN) DEBUG3(" little"); -#elif defined(BIG_ENDIAN) +#elif defined(RADIUS_BIG_ENDIAN) DEBUG3(" big"); #else DEBUG3(" unknown"); -- 2.1.4