ruby-changes:49718
From: shyouhei <ko1@a...>
Date: Mon, 15 Jan 2018 13:36:18 +0900 (JST)
Subject: [ruby-changes:49718] shyouhei:r61835 (trunk): give up RSTRING_PTR() being VALUE-aligned
shyouhei 2018-01-15 13:36:09 +0900 (Mon, 15 Jan 2018) New Revision: 61835 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61835 Log: give up RSTRING_PTR() being VALUE-aligned rb_setup_fake_str() can take arbitrary char* address, typicalluy C string literals. These arguments have no guarantee of alignment at all. It was not a wise idea for me to think RSTRING_PTR can be aligned. Modified files: trunk/include/ruby/ruby.h Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 61834) +++ include/ruby/ruby.h (revision 61835) @@ -957,13 +957,13 @@ struct RString { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L957 union { struct { long len; - ruby_aligned_char *ptr; + char *ptr; union { long capa; VALUE shared; } aux; } heap; - char RUBY_ALIGNAS(SIZEOF_VALUE) ary[RSTRING_EMBED_LEN_MAX + 1]; + char ary[RSTRING_EMBED_LEN_MAX + 1]; } as; }; #define RSTRING_EMBED_LEN(str) \ @@ -975,7 +975,7 @@ struct RString { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L975 RSTRING(str)->as.heap.len) #define RSTRING_PTR(str) \ (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \ - (ruby_aligned_char *)RSTRING(str)->as.ary : \ + RSTRING(str)->as.ary : \ RSTRING(str)->as.heap.ptr) #define RSTRING_END(str) \ (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/