[Bug #20928] Fix build when malloc_usable_size is available

Copy from gc/default/default.c and revert the part of 51bd81651794.
This commit is contained in:
Nobuyoshi Nakada 2024-12-04 16:54:48 +09:00 committed by Nobuyoshi Nakada
parent 4d460944c7
commit 86c01b6aa0
Notes: git 2024-12-04 08:50:21 +00:00

20
gc.c
View File

@ -30,6 +30,16 @@
/* MALLOC_HEADERS_BEGIN */
#ifndef HAVE_MALLOC_USABLE_SIZE
# ifdef _WIN32
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) _msize(a)
# elif defined HAVE_MALLOC_SIZE
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) malloc_size(a)
# endif
#endif
#ifdef HAVE_MALLOC_USABLE_SIZE
# ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
/* Alternative malloc header is included in ruby/missing.h */
# elif defined(HAVE_MALLOC_H)
@ -39,16 +49,6 @@
# elif defined(HAVE_MALLOC_MALLOC_H)
# include <malloc/malloc.h>
# endif
# ifdef _WIN32
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) _msize(a)
# elif defined HAVE_MALLOC_SIZE
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) malloc_size(a)
# endif
#else
# include <malloc.h>
#endif
/* MALLOC_HEADERS_END */