]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/_helpers.c
get: adjust for python 3 and test there
[bup.git] / lib / bup / _helpers.c
index b29c54cb782e16882d5043149c88423b37c980e9..312ecd4528a1376c7e9ced35e7fe33336b633628 100644 (file)
@@ -129,13 +129,6 @@ static uint64_t htonll(uint64_t value)
 #endif
 
 
-#ifdef __clang__
-#define INTEGRAL_ASSIGNMENT_FITS(dest, src)                             \
-    ({                                                                  \
-        *(dest) = (src);                                                \
-        *(dest) == (src) && (*(dest) < 1) == ((src) < 1);               \
-    })
-#else
 // Disabling sign-compare here should be fine since we're explicitly
 // checking for a sign mismatch, i.e. if the signs don't match, then
 // it doesn't matter what the value comparison says.
@@ -145,10 +138,10 @@ static uint64_t htonll(uint64_t value)
         _Pragma("GCC diagnostic push");                                 \
         _Pragma("GCC diagnostic ignored \"-Wsign-compare\"");           \
         *(dest) = (src);                                                \
-        *(dest) == (src) && (*(dest) < 1) == ((src) < 1);               \
+        int result = *(dest) == (src) && (*(dest) < 1) == ((src) < 1);  \
         _Pragma("GCC diagnostic pop");                                  \
+        result;                                                         \
     })
-#endif
 
 
 // At the moment any code that calls INTEGER_TO_PY() will have to
@@ -1171,7 +1164,7 @@ static PyObject *random_sha(PyObject *self, PyObject *args)
     memset(shabuf, 0, sizeof(shabuf));
     for (i=0; i < 20/4; i++)
        shabuf[i] = random();
-    return Py_BuildValue("s#", shabuf, 20);
+    return Py_BuildValue(rbuf_argf, shabuf, 20);
 }