diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-11-24 07:22:11 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-11-24 07:22:11 +0000 |
commit | 9b0f8ddc5c46cb59c8ee67ec483db29199d1d46c (patch) | |
tree | 53e6cdae6584a9728c491ee0a894292b260e5f4a /re.c | |
parent | be1fea072cd0d22788ef8a931c0c6b64a2503b5d (diff) |
This commit was manufactured by cvs2svn to create tag
'ruby_1_4_3_pre1'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/ruby_1_4_3_pre1@567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -182,6 +182,21 @@ kcode_reset_option() } } +int +rb_mbclen2(c, re) + unsigned char c; + VALUE re; +{ + int len; + + if (!FL_TEST(re, KCODE_FIXED)) + return mbclen(c); + kcode_set_option(re); + len = mbclen(c); + kcode_reset_option(); + return len; +} + extern int ruby_in_compile; static void @@ -260,10 +275,7 @@ static VALUE rb_reg_source(re) VALUE re; { - VALUE str = rb_str_new(0,0); - rb_reg_expr_str(str, RREGEXP(re)->str,RREGEXP(re)->len); - - return str; + return rb_str_new(RREGEXP(re)->str,RREGEXP(re)->len); } static VALUE @@ -538,6 +550,7 @@ rb_reg_search(reg, str, pos, reverse) } result = re_search(RREGEXP(reg)->ptr,RSTRING(str)->ptr,RSTRING(str)->len, pos, range, regs); + if (FL_TEST(reg, KCODE_FIXED)) kcode_reset_option(); @@ -710,7 +723,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 +1276,9 @@ Init_Regexp() rb_global_variable(®_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); |