AC_CHECK_FUNCS utimes
AC_CHECK_FUNCS lutimes
-builtin_mul_overflow_code="
-#include <stddef.h>
-int main(int argc, char **argv)
-{
- size_t n = 0, size = 0, total;
- __builtin_mul_overflow(n, size, &total);
- return 0;
-}
-"
-
-TLOGN "checking for __builtin_mul_overflow"
-if bup_try_c_code "$builtin_mul_overflow_code"; then
- AC_DEFINE BUP_HAVE_BUILTIN_MUL_OVERFLOW 1
- TLOG ' (found)'
-else
- TLOG ' (not found)'
-fi
-
AC_CHECK_FUNCS mincore
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",
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