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