diff --git a/configure.ac b/configure.ac index c6250401..51d9da93 100644 --- a/configure.ac +++ b/configure.ac @@ -129,6 +129,7 @@ AC_DEFINE_UNQUOTED(WIRED_STORAGEDIR, "${wired_storagedir}", AC_CHECK_FUNCS(explicit_bzero) AC_CHECK_FUNCS(rawmemchr) +AC_CHECK_FUNCS(reallocarray) AC_CHECK_HEADERS(linux/types.h linux/if_alg.h) diff --git a/src/missing.h b/src/missing.h index 2cc80aee..a5b92952 100644 --- a/src/missing.h +++ b/src/missing.h @@ -37,3 +37,10 @@ _Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"") _Pragma("GCC diagnostic pop") } #endif + +#ifndef HAVE_REALLOCARRAY +static inline void *reallocarray(void *ptr, size_t nmemb, size_t size) +{ + return realloc(ptr, nmemb * size); +} +#endif