]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: fix build on Solaris 11
authorWilly Tarreau <w@1wt.eu>
Fri, 20 May 2016 04:29:59 +0000 (06:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 May 2016 05:15:57 +0000 (07:15 +0200)
htonll()/ntohll() already exist on Solaris 11 with a different declaration,
causing a build error as reported by Jonathan Fisher. They used to exist on
OSX with a #define which allowed us to detect them. It was a bad idea to give
these functions a name subject to conflicts like this. Simply rename them
my_htonll()/my_ntohll() to definitely get rid of the conflict.

This patch must be backported to 1.6.

include/common/standard.h
src/sample.c

index f123f1a41dfb5ae7021f27f0eee34a3b72fa539e..8711ede28b7a8023e856395df2ccffbc42461dcb 100644 (file)
@@ -1048,8 +1048,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)
+static inline unsigned long long my_htonll(unsigned long long a)
 {
        union {
                struct {
@@ -1060,15 +1059,12 @@ 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)
+static inline unsigned long long my_ntohll(unsigned long long a)
 {
-       return htonll(a);
+       return my_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.
index 4f89bab394268b5f0fbea701a61f3b31a022fd0c..9e6baa847a534a5bc7a28b0fb5fdf7e14f407933 100644 (file)
@@ -765,7 +765,7 @@ static int c_int2bin(struct sample *smp)
 {
        struct chunk *chk = get_trash_chunk();
 
-       *(unsigned long long int *)chk->str = htonll(smp->data.u.sint);
+       *(unsigned long long int *)chk->str = my_htonll(smp->data.u.sint);
        chk->len = 8;
 
        smp->data.u.str = *chk;