summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/re.c b/re.c
index ac73732..8bc15c1 100644
--- a/re.c
+++ b/re.c
@@ -261,7 +261,7 @@ rb_reg_source(re)
VALUE re;
{
VALUE str = rb_str_new(0,0);
- rb_reg_expr_str(str, RREGEXP(re)->str,RREGEXP(re)->len);
+ rb_reg_expr_str(str, RREGEXP(re)->str, RREGEXP(re)->len);
return str;
}
@@ -710,7 +710,7 @@ static VALUE
match_string(match)
VALUE match;
{
- return rb_str_dup(RMATCH(match)->str);
+ return RMATCH(match)->str; /* str is frozen */
}
VALUE rb_cRegexp;
@@ -1263,7 +1263,9 @@ Init_Regexp()
rb_global_variable(&reg_cache);
rb_global_variable(&matchcache);
- rb_cMatch = rb_define_class("MatchingData", rb_cData);
+ rb_cMatch = rb_define_class("MatchingData", rb_cObject);
+ rb_undef_method(CLASS_OF(rb_cMatch), "new");
+
rb_define_method(rb_cMatch, "clone", match_clone, 0);
rb_define_method(rb_cMatch, "size", match_size, 0);
rb_define_method(rb_cMatch, "length", match_size, 0);