From: liquidaty Date: Thu, 8 Sep 2022 16:59:37 +0000 (-0700) Subject: fix to enable successful build with mingw64 X-Git-Tag: vectorscan/5.4.8~1^2~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F121%2Fhead;p=thirdparty%2Fvectorscan.git fix to enable successful build with mingw64 --- diff --git a/src/util/alloc.cpp b/src/util/alloc.cpp index f3a2a259..40004932 100644 --- a/src/util/alloc.cpp +++ b/src/util/alloc.cpp @@ -47,7 +47,15 @@ namespace ue2 { #endif /* get us a posix_memalign from somewhere */ -#if !defined(HAVE_POSIX_MEMALIGN) +#if defined(__MINGW32__) || defined(__MINGW64__) + #include + #include + #include + #include + + #define posix_memalign(A, B, C) ((*A = (void *)__mingw_aligned_malloc(C, B)) == nullptr) + +#elif !defined(HAVE_POSIX_MEMALIGN) # if defined(HAVE_MEMALIGN) #define posix_memalign(A, B, C) ((*A = (void *)memalign(B, C)) == nullptr) # elif defined(HAVE__ALIGNED_MALLOC) @@ -77,7 +85,11 @@ void aligned_free_internal(void *ptr) { return; } +#if defined(__MINGW32__) || defined(__MINGW64__) + __mingw_aligned_free(ptr); +#else free(ptr); +#endif } /** \brief 64-byte aligned, zeroed malloc.