From 49fc21f31e84663c02660bdbfee72adcf4040947 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 17 Dec 2002 12:15:45 +0000 Subject: [PATCH] * re.c (rb_reg_nth_match): tail sharing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 +++- re.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8166a7dda6..62f8e5fdb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Tue Dec 17 19:29:45 2002 Nobuyoshi Nakada +Tue Dec 17 21:08:29 2002 Nobuyoshi Nakada * node.h (NODE_ATTRASGN): new node, assignment to attribute. [ruby-core:00637]. @@ -9,6 +9,8 @@ Tue Dec 17 19:29:45 2002 Nobuyoshi Nakada * string.c (rb_str_substr): tail sharing. [ruby-core:00650] + * re.c (rb_reg_nth_match): ditto. + Tue Dec 17 04:03:45 2002 Tanaka Akira * lib/open-uri.rb: new file. diff --git a/re.c b/re.c index 8d482736d4..52fca7c2e4 100644 --- a/re.c +++ b/re.c @@ -778,8 +778,8 @@ rb_reg_nth_match(nth, match) if (start == -1) return Qnil; end = RMATCH(match)->END(nth); len = end - start; - str = rb_str_new(RSTRING(RMATCH(match)->str)->ptr + start, len); - if (OBJ_TAINTED(match)) OBJ_TAINT(str); + str = rb_str_substr(RMATCH(match)->str, start, len); + OBJ_INFECT(str, match); return str; }