Skip to content

Commit 21e403a

Browse files
weissgitster
authored andcommitted
Don't redefine htonl and ntohl on big-endian
Since commit 0fcabde, 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ß <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7a49c25 commit 21e403a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compat/bswap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ static inline uint32_t default_swab32(uint32_t val)
1717
((val & 0x000000ff) << 24));
1818
}
1919

20+
#undef bswap32
21+
2022
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
2123

2224
#define bswap32(x) ({ \

0 commit comments

Comments
 (0)