From 25fd278459d5862383ad55493e082257254d64ab Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 4 Feb 2016 06:44:55 +0000 Subject: [PATCH] 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 --- re.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/re.c b/re.c index 46526af9a8..d4352d340d 100644 --- a/re.c +++ b/re.c @@ -500,7 +500,7 @@ rb_reg_source(VALUE re) VALUE str; 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); return str; }