]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/_helpers.c
Drop builtin_mul_overflow in favor of INT_MULTIPLY_OK
[bup.git] / lib / bup / _helpers.c
index cb5e934faa656ed897e590c30b84301d13300887..391597ff04a6eba86d1a253b7d310a396bf30245 100644 (file)
@@ -125,16 +125,10 @@ static void *checked_calloc(size_t n, size_t size)
     return result;
 }
 
-#ifndef BUP_HAVE_BUILTIN_MUL_OVERFLOW
-
-#define checked_malloc checked_calloc
-
-#else // defined BUP_HAVE_BUILTIN_MUL_OVERFLOW
-
 static void *checked_malloc(size_t n, size_t size)
 {
     size_t total;
-    if (__builtin_mul_overflow(n, size, &total))
+    if (!INT_MULTIPLY_OK(n, size, &total))
     {
         PyErr_Format(PyExc_OverflowError,
                      "request to allocate %zu items of size %zu is too large",
@@ -147,8 +141,6 @@ static void *checked_malloc(size_t n, size_t size)
     return result;
 }
 
-#endif // defined BUP_HAVE_BUILTIN_MUL_OVERFLOW
-
 
 #ifndef htonll
 // This function should technically be macro'd out if it's going to be used