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

take alignof instead of sizeof

win32ole.c includes ALLOCA_N(struct myCPINFOEX, 1).  On such case
it is not a wise idea to align to the size of that struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2018-01-15 06:47:56 +00:00
parent 7c088b9662
commit 8699a7a006

View file

@ -1603,12 +1603,12 @@ rb_num2char_inline(VALUE x)
# undef HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
#endif
#ifdef HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
#if defined(HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN) && defined(RUBY_ALIGNOF)
/* I don't know why but __builtin_alloca_with_align's second argument
takes bits rather than bytes. */
#define ALLOCA_N(type, n) \
(type*)__builtin_alloca_with_align((sizeof(type)*(n)), \
sizeof(type) * CHAR_BIT)
RUBY_ALIGNOF(type) * CHAR_BIT)
#else
#define ALLOCA_N(type,n) ((type*)alloca(sizeof(type)*(n)))
#endif