[macruby-changes] [2330] MacRuby/trunk/re.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 15 19:03:19 PDT 2009


Revision: 2330
          http://trac.macosforge.org/projects/ruby/changeset/2330
Author:   lsansonetti at apple.com
Date:     2009-08-15 19:03:18 -0700 (Sat, 15 Aug 2009)
Log Message:
-----------
cache the Match object if possible and marked an area that needs to be optimized

Modified Paths:
--------------
    MacRuby/trunk/re.c

Modified: MacRuby/trunk/re.c
===================================================================
--- MacRuby/trunk/re.c	2009-08-16 02:02:45 UTC (rev 2329)
+++ MacRuby/trunk/re.c	2009-08-16 02:03:18 UTC (rev 2330)
@@ -1527,24 +1527,22 @@
 	result /= charsize;
     }
 
-#if WITH_OBJC
-    VALUE match = match_alloc(rb_cMatch, 0);
-#else
     VALUE match = rb_backref_get();
     if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
-	match = match_alloc(rb_cMatch);
+	match = match_alloc(rb_cMatch, 0);
     }
     else {
-	if (rb_safe_level() >= 3)
+	if (rb_safe_level() >= 3) {
 	    OBJ_TAINT(match);
-	else
+	}
+	else {
 	    FL_UNSET(match, FL_TAINT);
+	}
     }
-#endif
 
     onig_region_copy(RMATCH_REGS(match), pregs);
     onig_region_free(pregs, 0);
-    GC_WB(&RMATCH(match)->str, rb_str_new4(str));
+    GC_WB(&RMATCH(match)->str, rb_str_new4(str)); // OPTIMIZE
     GC_WB(&RMATCH(match)->regexp, re);
     RMATCH(match)->rmatch->char_offset_updated = 0;
     rb_backref_set(match);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090815/837145b9/attachment-0001.html>


More information about the macruby-changes mailing list