[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Acl-devel] [PATCH] acl: remove byteorder.h prefer <endian.h> instea
From: |
Mike Frysinger |
Subject: |
Re: [Acl-devel] [PATCH] acl: remove byteorder.h prefer <endian.h> instead |
Date: |
Wed, 23 Dec 2015 13:02:51 -0500 |
On 14 Dec 2015 00:35, Mike Frysinger wrote:
> On 14 Dec 2015 02:15, Cristian Rodríguez wrote:
> > On Mon, Dec 14, 2015 at 2:12 AM, Mike Frysinger wrote:
> > > endian.h is not a portable header so we do not want to require it
> >
> > huh ? Did you read the code ? it was already required...
>
> we're doing so just for __BYTE_ORDER and we can get that via portable
> means: AC_C_BIGENDIAN. at which point we can drop the endian.h include.
i've pushed this fix now:
From 0b8d28449925711e69d228c24f327c5bf0c2b627 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <address@hidden>
Date: Wed, 23 Dec 2015 13:02:03 -0500
Subject: [PATCH acl] use portable AC_C_BIGENDIAN
This allows us to avoid using endian.h.
---
configure.ac | 1 +
libacl/byteorder.h | 8 +++-----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index cd3c680..0525c62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AC_USE_SYSTEM_EXTENSIONS
AC_FUNC_GCC_VISIBILITY
+AC_C_BIGENDIAN
AM_PROG_AR
LT_INIT
diff --git a/libacl/byteorder.h b/libacl/byteorder.h
index 05f5d87..772fbc0 100644
--- a/libacl/byteorder.h
+++ b/libacl/byteorder.h
@@ -15,9 +15,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <endian.h>
+#include "config.h"
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
# define cpu_to_le16(w16) le16_to_cpu(w16)
# define le16_to_cpu(w16) ((u_int16_t)((u_int16_t)(w16) >> 8) | \
(u_int16_t)((u_int16_t)(w16) << 8))
@@ -26,12 +26,10 @@
(u_int32_t)(((u_int32_t)(w32) >> 8) & 0xFF00) | \
(u_int32_t)(((u_int32_t)(w32) << 8) & 0xFF0000) | \
(u_int32_t)( (u_int32_t)(w32) <<24))
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
+#else
# define cpu_to_le16(w16) ((u_int16_t)(w16))
# define le16_to_cpu(w16) ((u_int16_t)(w16))
# define cpu_to_le32(w32) ((u_int32_t)(w32))
# define le32_to_cpu(w32) ((u_int32_t)(w32))
-#else
-# error unknown endianess?
#endif
--
2.6.2
-mike
signature.asc
Description: Digital signature