]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: Fix the build on OSX (htonll/ntohll)
authorJoseph Lynch <joe.e.lynch@gmail.com>
Wed, 7 Oct 2015 02:43:18 +0000 (19:43 -0700)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2015 08:11:59 +0000 (10:11 +0200)
htonll and ntohll were defined in 5b4dd683cb but on osx they are already
defined in sys/_endian.h. So, we check if they are defined before
declaring them.

[wt: no backport needed]

include/common/standard.h

index d28ab79c8ff912b9ec53c1255601549f114ac69c..0fe0fb08b3e47e25a69d794e10be7a1fa1754fca 100644 (file)
@@ -1004,6 +1004,7 @@ static inline unsigned char utf8_return_length(unsigned char code)
  * the whole code is optimized out. In little endian, with a decent compiler,
  * a few bswap and 2 shifts are left, which is the minimum acceptable.
  */
+#ifndef htonll
 static inline unsigned long long htonll(unsigned long long a)
 {
        union {
@@ -1015,12 +1016,15 @@ static inline unsigned long long htonll(unsigned long long a)
        } w = { .by64 = a };
        return ((unsigned long long)htonl(w.by32.w1) << 32) | htonl(w.by32.w2);
 }
+#endif
 
 /* Turns 64-bit value <a> from network byte order to host byte order. */
+#ifndef ntohll
 static inline unsigned long long ntohll(unsigned long long a)
 {
        return htonll(a);
 }
+#endif
 
 /* returns a 64-bit a timestamp with the finest resolution available. The
  * unit is intentionally not specified. It's mostly used to compare dates.