{"thread":{"id":"23224","subject":"[PATCH] Don't redefine htonl and ntohl on big-endian","startedAt":"2010-03-29T10:22:19Z","lastAt":"2010-03-29T10:22:19Z","messageCount":1,"participants":["Holger Weiß"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"138067","messageId":"20100329102219.GC14869@CIS.FU-Berlin.DE","threadId":"23224","inReplyTo":null,"subject":"[PATCH] Don't redefine htonl and ntohl on big-endian","fromName":"Holger Weiß","fromEmail":"holger@zedat.fu-berlin.de","sentAt":"2010-03-29T10:22:19Z","receivedAt":"2010-03-29T10:22:19Z","isPatch":true,"sender":{"key":"holger@zedat.fu-berlin.de","avatar":"https://avatars.githubusercontent.com/u/71850?v=4"},"body":"Since commit 0fcabdeb52b79775173d009ccc179db104dfbb66, compat/bswap.h\nredefined htonl and ntohl to bswap32 not only if bswap32 has been\ndefined earlier in compat/bswap.h (which is done only on selected\nplatforms), but also if bswap32 has been defined anywhere else.  This\nbroke Git at least for NetBSD systems running on big-endian machines\n(where ntohl and htonl should, of course, be NOOPs), since NetBSD\ndefines a bswap32 macro in the system headers.\n\nSo, we now undefine any previously defined bswap32 in compat/bswap.h\nbefore defining our own.\n\nSigned-off-by: Holger Weiß <holger@zedat.fu-berlin.de>\n---\n compat/bswap.h |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/bswap.h b/compat/bswap.h\nindex f3b8c44..54756db 100644\n--- a/compat/bswap.h\n+++ b/compat/bswap.h\n@@ -17,6 +17,8 @@ static inline uint32_t default_swab32(uint32_t val)\n \t\t((val & 0x000000ff) << 24));\n }\n \n+#undef bswap32\n+\n #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))\n \n #define bswap32(x) ({ \\\n-- \n1.7.0.3\n"}]}