From 49dc889c7f88f4a130849896bde57f7e72b4900e Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Sun, 24 May 2020 10:51:35 +0200 Subject: [PATCH] Utils: Use unaligned malloc on windows too We do not align the small string anymore. Change-Id: I933f95ea14f90fff29cb8ab75d987039ea7f8a3e Reviewed-by: Thomas Hartmann --- src/libs/utils/smallstringmemory.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/libs/utils/smallstringmemory.h b/src/libs/utils/smallstringmemory.h index c9687a09fb6..08a78be271d 100644 --- a/src/libs/utils/smallstringmemory.h +++ b/src/libs/utils/smallstringmemory.h @@ -37,34 +37,24 @@ namespace Memory { inline char *allocate(std::size_t size) { -#ifdef Q_OS_WIN32 - return static_cast(_aligned_malloc(size, 64)); -#else return static_cast(std::malloc(size)); -#endif } inline void deallocate(char *memory) { -#ifdef Q_OS_WIN32 - _aligned_free(memory); -#else -#pragma GCC diagnostic push #if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfree-nonheap-object" #endif std::free(memory); +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif } inline char *reallocate(char *oldMemory, std::size_t newSize) { -#ifdef Q_OS_WIN32 - return static_cast(_aligned_realloc(oldMemory, newSize, 64)); -#else - return static_cast(std::realloc(oldMemory, newSize)); -#endif + return static_cast(std::realloc(oldMemory, newSize)); } } // namespace Memory