From 86c01b6aa0833e1bddda6ba8315c9d414aef0f76 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 4 Dec 2024 16:54:48 +0900 Subject: [PATCH] [Bug #20928] Fix build when `malloc_usable_size` is available Copy from gc/default/default.c and revert the part of 51bd81651794. --- gc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gc.c b/gc.c index 5342628b0d..4124d8e42d 100644 --- a/gc.c +++ b/gc.c @@ -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 # 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 #endif /* MALLOC_HEADERS_END */