diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-10-08 18:19:47 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-10-08 18:19:47 +0900 |
| commit | 2bb6fe3854e2a4854bb89bfce4eaaea9d848fd1b (patch) | |
| tree | e94ed51471972f3866110b4ee0b8d5d3f05781cd /include/ruby/internal | |
| parent | 43dbb9a93f4de3f1170d7d18641c30e81cc08365 (diff) | |
[Bug #21629] Initialize `struct RString`
Diffstat (limited to 'include/ruby/internal')
| -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 35af03f7c8..63cdff8e09 100644 --- a/include/ruby/internal/core/rbasic.h +++ b/include/ruby/internal/core/rbasic.h @@ -115,6 +115,9 @@ RBasic { #endif { } +# 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 0bca74e688..9cf9daa97c 100644 --- a/include/ruby/internal/core/rstring.h +++ b/include/ruby/internal/core/rstring.h @@ -395,7 +395,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.len = RSTRING_LEN(str); retval.as.heap.ptr = RSTRING(str)->as.embed.ary; return retval; |
