summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/string.c b/string.c
index a85676f482..199efe7a2d 100644
--- a/string.c
+++ b/string.c
@@ -136,6 +136,8 @@ static int
fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
{
VALUE *fstr = (VALUE *)arg;
+ VALUE str = (VALUE)*key;
+
if (existing) {
/* because of lazy sweep, str may be unmarked already and swept
* at next time */
@@ -143,7 +145,6 @@ fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existi
return ST_STOP;
}
- VALUE str = *key;
if (STR_SHARED_P(str)) {
/* str should not be shared */
str = rb_enc_str_new(RSTRING_PTR(str), RSTRING_LEN(str), STR_ENC_GET(str));