Skip to content

Commit 86c01b6

Browse files
committed
[Bug #20928] Fix build when malloc_usable_size is available
Copy from gc/default/default.c and revert the part of 51bd816.
1 parent 4d46094 commit 86c01b6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

gc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030

3131
/* MALLOC_HEADERS_BEGIN */
3232
#ifndef HAVE_MALLOC_USABLE_SIZE
33+
# ifdef _WIN32
34+
# define HAVE_MALLOC_USABLE_SIZE
35+
# define malloc_usable_size(a) _msize(a)
36+
# elif defined HAVE_MALLOC_SIZE
37+
# define HAVE_MALLOC_USABLE_SIZE
38+
# define malloc_usable_size(a) malloc_size(a)
39+
# endif
40+
#endif
41+
42+
#ifdef HAVE_MALLOC_USABLE_SIZE
3343
# ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
3444
/* Alternative malloc header is included in ruby/missing.h */
3545
# elif defined(HAVE_MALLOC_H)
@@ -39,16 +49,6 @@
3949
# elif defined(HAVE_MALLOC_MALLOC_H)
4050
# include <malloc/malloc.h>
4151
# endif
42-
43-
# ifdef _WIN32
44-
# define HAVE_MALLOC_USABLE_SIZE
45-
# define malloc_usable_size(a) _msize(a)
46-
# elif defined HAVE_MALLOC_SIZE
47-
# define HAVE_MALLOC_USABLE_SIZE
48-
# define malloc_usable_size(a) malloc_size(a)
49-
# endif
50-
#else
51-
# include <malloc.h>
5252
#endif
5353

5454
/* MALLOC_HEADERS_END */

0 commit comments

Comments
 (0)