Make embedded string length a long for VWA
A short (2 bytes) will cause unaligned struct accesses when strings are used as a buffer to directly store binary data.
This commit is contained in:
parent
e28dbd0f3d
commit
2d81a718ec
Notes:
git
2022-01-13 02:01:32 +09:00
@ -280,7 +280,7 @@ struct RString {
|
|||||||
/** Embedded contents. */
|
/** Embedded contents. */
|
||||||
struct {
|
struct {
|
||||||
#if USE_RVARGC
|
#if USE_RVARGC
|
||||||
unsigned short len;
|
long len;
|
||||||
/* This is a length 1 array because:
|
/* This is a length 1 array because:
|
||||||
* 1. GCC has a bug that does not optimize C flexible array members
|
* 1. GCC has a bug that does not optimize C flexible array members
|
||||||
* (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
|
* (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
|
||||||
|
@ -66,7 +66,7 @@ class Test_StringCapacity < Test::Unit::TestCase
|
|||||||
|
|
||||||
def embed_header_size
|
def embed_header_size
|
||||||
if GC.using_rvargc?
|
if GC.using_rvargc?
|
||||||
2 * RbConfig::SIZEOF['void*'] + RbConfig::SIZEOF['short']
|
2 * RbConfig::SIZEOF['void*'] + RbConfig::SIZEOF['long']
|
||||||
else
|
else
|
||||||
2 * RbConfig::SIZEOF['void*']
|
2 * RbConfig::SIZEOF['void*']
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user