Bug 1460720 Do not define _aligned_malloc - instead define _aligned_malloc_impl and export _aligned_malloc r?glandium draft
authorTom Ritter <tom@mozilla.com>
Tue, 15 May 2018 11:10:48 -0500
changeset 795358 e4f477aca594d2b92af2413180cb795302b8ee88
parent 795357 dc61180ee04f32724ad1181e0bc357bbd0c7906b
push id109950
push userbmo:tom@mozilla.com
push dateTue, 15 May 2018 18:38:10 +0000
reviewersglandium
bugs1460720
milestone60.0
Bug 1460720 Do not define _aligned_malloc - instead define _aligned_malloc_impl and export _aligned_malloc r?glandium MozReview-Commit-ID: 3EwAd81Iz7r
memory/build/mozmemory_wrap.cpp
memory/build/mozmemory_wrap.h
mozglue/build/mozglue.def.in
--- a/memory/build/mozmemory_wrap.cpp
+++ b/memory/build/mozmemory_wrap.cpp
@@ -155,13 +155,13 @@ wcsdup_impl(const wchar_t* src)
   size_t len = wcslen(src);
   wchar_t* dst = (wchar_t*)malloc_impl((len + 1) * sizeof(wchar_t));
   if (dst)
     wcsncpy(dst, src, len + 1);
   return dst;
 }
 
 MOZ_MEMORY_API void*
-_aligned_malloc(size_t size, size_t alignment)
+_aligned_malloc_impl(size_t size, size_t alignment)
 {
   return memalign_impl(alignment, size);
 }
 #endif // XP_WIN
--- a/memory/build/mozmemory_wrap.h
+++ b/memory/build/mozmemory_wrap.h
@@ -151,16 +151,17 @@
 #define malloc_usable_size_impl mozmem_malloc_impl(malloc_usable_size)
 #define malloc_good_size_impl mozmem_malloc_impl(malloc_good_size)
 
 // Duplication functions
 #define strndup_impl mozmem_dup_impl(strndup)
 #define strdup_impl mozmem_dup_impl(strdup)
 #ifdef XP_WIN
 #define wcsdup_impl mozmem_dup_impl(wcsdup)
+#define _aligned_malloc_impl mozmem_dup_impl(_aligned_malloc)
 #endif
 
 // String functions
 #ifdef ANDROID
 // Bug 801571 and Bug 879668, libstagefright uses vasprintf, causing malloc()/
 // free() to be mismatched between bionic and mozglue implementation.
 #define vasprintf_impl mozmem_dup_impl(vasprintf)
 #define asprintf_impl mozmem_dup_impl(asprintf)
--- a/mozglue/build/mozglue.def.in
+++ b/mozglue/build/mozglue.def.in
@@ -10,15 +10,15 @@ EXPORTS
   malloc=je_malloc
   calloc=je_calloc
   realloc=je_realloc
   free=je_free
   posix_memalign=je_posix_memalign
   malloc_usable_size=je_malloc_usable_size
   malloc_good_size=je_malloc_good_size
   _aligned_free=je_free
-  _aligned_malloc
+  _aligned_malloc=wrap__aligned_malloc
   strndup=wrap_strndup
   strdup=wrap_strdup
   _strdup=wrap_strdup
   wcsdup=wrap_wcsdup
   _wcsdup=wrap_wcsdup
 #endif