Skip to content

Commit

Permalink
Fix Android build break
Browse files Browse the repository at this point in the history
Android doesn't have  `posix_memalign`, detect this case with preprocessor macros and compile accordingly.
  • Loading branch information
codemercenary committed Jul 31, 2015
1 parent 28abc24 commit fa6ec5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/autowiring/CreationRulesUnix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
#include <cstdlib>

void* autowiring::aligned_malloc(size_t ncb, size_t align) {
#if _POSIX_C_SOURCE < 200112L && _XOPEN_SOURCE < 600 && !defined(__APPLE__)
return memalign(align, ncb);
#else
void* pRetVal;
if(posix_memalign(&pRetVal, align, ncb))
if (posix_memalign(&pRetVal, align, ncb))
return nullptr;
return pRetVal;
#endif
}

void autowiring::aligned_free(void* ptr) {
Expand Down

0 comments on commit fa6ec5f

Please sign in to comment.