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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bca40b8b56
commit
e41b4a45a4
@ -957,13 +957,13 @@ struct RString {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
long len;
|
long len;
|
||||||
ruby_aligned_char *ptr;
|
char *ptr;
|
||||||
union {
|
union {
|
||||||
long capa;
|
long capa;
|
||||||
VALUE shared;
|
VALUE shared;
|
||||||
} aux;
|
} aux;
|
||||||
} heap;
|
} heap;
|
||||||
char RUBY_ALIGNAS(SIZEOF_VALUE) ary[RSTRING_EMBED_LEN_MAX + 1];
|
char ary[RSTRING_EMBED_LEN_MAX + 1];
|
||||||
} as;
|
} as;
|
||||||
};
|
};
|
||||||
#define RSTRING_EMBED_LEN(str) \
|
#define RSTRING_EMBED_LEN(str) \
|
||||||
@ -975,7 +975,7 @@ struct RString {
|
|||||||
RSTRING(str)->as.heap.len)
|
RSTRING(str)->as.heap.len)
|
||||||
#define RSTRING_PTR(str) \
|
#define RSTRING_PTR(str) \
|
||||||
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
|
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
|
||||||
(ruby_aligned_char *)RSTRING(str)->as.ary : \
|
RSTRING(str)->as.ary : \
|
||||||
RSTRING(str)->as.heap.ptr)
|
RSTRING(str)->as.heap.ptr)
|
||||||
#define RSTRING_END(str) \
|
#define RSTRING_END(str) \
|
||||||
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
|
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user