Bug 1402647 - Add a memalign implementation on platforms that don't have one. r=njn

--HG--
extra : rebase_source : bf1ff9da4c4647f5e930194d0d008466f0b2b593
This commit is contained in:
Mike Hommey 2017-09-26 06:59:03 +09:00
parent d7703e388f
commit 77ff4db6d7

View file

@ -8,6 +8,25 @@
#include "mozjemalloc.h"
#include <stdlib.h>
#ifndef HAVE_MEMALIGN
namespace {
inline void* memalign(size_t aAlignment, size_t aSize)
{
#ifdef XP_WIN
return _aligned_malloc(aSize, aAlignment);
#else
void* ret;
if (posix_memalign(&ret, aAlignment, aSize) != 0) {
return nullptr;
}
return ret;
#endif
}
}
#endif
struct SystemMalloc {
#define MALLOC_DECL(name, return_type, ...) \
static inline return_type \