Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/branches/icu@3736 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Mar 11, 2010
1 parent c596b54 commit bfd57bd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions re.cpp
Expand Up @@ -99,7 +99,7 @@ str_to_unistr(VALUE str)

rb_str_get_uchars(str, &chars, &chars_len, &need_free);

UnicodeString *unistr = new UnicodeString((const UChar *)chars, chars_len);
UnicodeString *unistr = new UnicodeString(false, (const UChar *)chars, chars_len);

if (need_free) {
free(chars);
Expand Down Expand Up @@ -132,9 +132,8 @@ init_from_string(rb_regexp_t *regexp, VALUE str, int option, VALUE *excp)

sanitize_regexp_string(unistr);

UParseError pe;
UErrorCode status = U_ZERO_ERROR;
RegexPattern *pattern = RegexPattern::compile(*unistr, option, pe, status);
RegexPattern *pattern = RegexPattern::compile(*unistr, option, status);

if (pattern == NULL) {
delete unistr;
Expand All @@ -150,7 +149,6 @@ init_from_string(rb_regexp_t *regexp, VALUE str, int option, VALUE *excp)
regexp_finalize(regexp);
regexp->pattern = pattern;
regexp->unistr = unistr;

return true;
}

Expand Down Expand Up @@ -563,11 +561,11 @@ rb_reg_search(VALUE re, VALUE str, int pos, bool reverse)
if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
// Creating a new Match object.
match = (VALUE)match_alloc(rb_cMatch, 0);
rb_backref_set(match);
res = (rb_match_result_t *)xmalloc(sizeof(rb_match_result_t)
* res_count);
GC_WB(&RMATCH(match)->results, res);
GC_WB(&RMATCH(match)->str, rb_str_new(NULL, 0));
rb_backref_set(match);
}
else {
// Reusing the previous Match object.
Expand Down

0 comments on commit bfd57bd

Please sign in to comment.