1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

return shared string

* re.c (rb_reg_source): return shared string without copying.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-02-04 06:44:55 +00:00
parent 94c70c7d72
commit 25fd278459

2
re.c
View file

@ -500,7 +500,7 @@ rb_reg_source(VALUE re)
VALUE str; VALUE str;
rb_reg_check(re); rb_reg_check(re);
str = rb_enc_str_new(RREGEXP_SRC_PTR(re),RREGEXP_SRC_LEN(re), rb_enc_get(re)); str = rb_str_dup(RREGEXP_SRC(re));
if (OBJ_TAINTED(re)) OBJ_TAINT(str); if (OBJ_TAINTED(re)) OBJ_TAINT(str);
return str; return str;
} }