diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-10-08 18:19:47 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-01-22 18:02:29 +0900 |
| commit | 357d601e8b44b2d2b99ffaf05f6912c4c705c4e6 (patch) | |
| tree | c0e624ca4c5abbcac295bb6f50a0fafcfa212adb /include/ruby | |
| parent | 2051ac34b72e95de6049eb2d226e5a55024c83c7 (diff) | |
[Bug #21629] Initialize `struct RString`ruby_3_2
Diffstat (limited to 'include/ruby')
| -rw-r--r-- | include/ruby/internal/core/rbasic.h | 3 | ||||
| -rw-r--r-- | include/ruby/internal/core/rstring.h | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/ruby/internal/core/rbasic.h b/include/ruby/internal/core/rbasic.h index 4617f743a7..c63968ce13 100644 --- a/include/ruby/internal/core/rbasic.h +++ b/include/ruby/internal/core/rbasic.h @@ -104,6 +104,9 @@ RBasic { klass(RBIMPL_VALUE_NULL) { } +# define RBASIC_INIT RBasic() +#else +# define RBASIC_INIT {RBIMPL_VALUE_NULL} #endif }; diff --git a/include/ruby/internal/core/rstring.h b/include/ruby/internal/core/rstring.h index e394ab7dca..7240c60380 100644 --- a/include/ruby/internal/core/rstring.h +++ b/include/ruby/internal/core/rstring.h @@ -462,7 +462,7 @@ rbimpl_rstring_getmem(VALUE str) } else { /* Expecting compilers to optimize this on-stack struct away. */ - struct RString retval; + struct RString retval = {RBASIC_INIT}; retval.as.heap.len = RSTRING_EMBED_LEN(str); retval.as.heap.ptr = RSTRING(str)->as.embed.ary; return retval; |
