1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fix condition for free

* gc.c (aligned_free): fix condition for free.  memalign() and
  posix_memalign() are not defined together normally.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-03-18 14:21:31 +00:00
parent 1d006f353d
commit e30dbb3671
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sun Mar 18 23:21:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (aligned_free): fix condition for free. memalign() and
posix_memalign() are not defined together normally.
Sun Mar 18 18:31:45 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* gc.c (aligned_malloc, aligned_free): added fallback implementations

5
gc.c
View file

@ -1100,7 +1100,8 @@ aligned_malloc(size_t alignment, size_t size)
#elif defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign(&res, alignment, size) == 0) {
return res;
} else {
}
else {
return NULL;
}
#elif defined(HAVE_MEMALIGN)
@ -1129,7 +1130,7 @@ aligned_free(void *ptr)
__mingw_aligned_free(ptr);
#elif defined _WIN32 && !defined __CYGWIN__
_aligned_free(ptr);
#elif defined(HAVE_MEMALIGN) && defined(HAVE_POSIX_MEMALIGN)
#elif defined(HAVE_MEMALIGN) || defined(HAVE_POSIX_MEMALIGN)
free(ptr);
#else
free(((void**)ptr)[-1]);