]> arthur.barton.de Git - bup.git/commitdiff
Omit htonll when already #defined
authorR. Andrew Ohana <andrew.ohana@gmail.com>
Tue, 29 Jul 2014 20:38:49 +0000 (13:38 -0700)
committerRob Browning <rlb@defaultvalue.org>
Wed, 30 Jul 2014 16:10:02 +0000 (11:10 -0500)
OS X 10.10 Yosemite defines it as a macro.

Signed-off-by: R. Andrew Ohana <andrew.ohana@gmail.com>
[rlb@defaultvalue.org: adjust comments; adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c

index 6957d2cbe902486886b40c043ad3f342bc614727..4d2f9fd14aee6885be851b20e0cf110ab00072af 100644 (file)
 
 static int istty2 = 0;
 
+
+#ifndef htonll
+// This function should technically be macro'd out if it's going to be used
+// more than ocasionally.  As of this writing, it'll actually never be called
+// in real world bup scenarios (because our packs are < MAX_INT bytes).
+static uint64_t htonll(uint64_t value)
+{
+    static const int endian_test = 42;
+
+    if (*(char *)&endian_test == endian_test) // LSB-MSB
+       return ((uint64_t)htonl(value & 0xFFFFFFFF) << 32) | htonl(value >> 32);
+    return value; // already in network byte order MSB-LSB
+}
+#endif
+
+
 // At the moment any code that calls INTGER_TO_PY() will have to
 // disable -Wtautological-compare for clang.  See below.
 
@@ -586,18 +602,6 @@ static PyObject *merge_into(PyObject *self, PyObject *args)
     return PyLong_FromUnsignedLong(count);
 }
 
-// This function should technically be macro'd out if it's going to be used
-// more than ocasionally.  As of this writing, it'll actually never be called
-// in real world bup scenarios (because our packs are < MAX_INT bytes).
-static uint64_t htonll(uint64_t value)
-{
-    static const int endian_test = 42;
-
-    if (*(char *)&endian_test == endian_test) // LSB-MSB
-       return ((uint64_t)htonl(value & 0xFFFFFFFF) << 32) | htonl(value >> 32);
-    return value; // already in network byte order MSB-LSB
-}
-
 #define FAN_ENTRIES 256
 
 static PyObject *write_idx(PyObject *self, PyObject *args)