From 21e403a7b956a95a36f218439f82b1c8af869257 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Holger=20Wei=C3=9F?= Date: Mon, 29 Mar 2010 12:22:19 +0200 Subject: [PATCH] Don't redefine htonl and ntohl on big-endian MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since commit 0fcabdeb52b79775173d009ccc179db104dfbb66, compat/bswap.h redefined htonl and ntohl to bswap32 not only if bswap32 has been defined earlier in compat/bswap.h (which is done only on selected platforms), but also if bswap32 has been defined anywhere else. This broke Git at least for NetBSD systems running on big-endian machines (where ntohl and htonl should, of course, be NOOPs), since NetBSD defines a bswap32 macro in the system headers. So, we now undefine any previously defined bswap32 in compat/bswap.h before defining our own. Signed-off-by: Holger Weiß Signed-off-by: Junio C Hamano --- compat/bswap.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/bswap.h b/compat/bswap.h index f3b8c44181..54756dbb05 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -17,6 +17,8 @@ static inline uint32_t default_swab32(uint32_t val) ((val & 0x000000ff) << 24)); } +#undef bswap32 + #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define bswap32(x) ({ \ -- 2.11.4.GIT