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

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 3 15:14:18 PST 2011


Revision: 5108
          http://trac.macosforge.org/projects/ruby/changeset/5108
Author:   lsansonetti at apple.com
Date:     2011-01-03 15:14:14 -0800 (Mon, 03 Jan 2011)
Log Message:
-----------
keep rmatch busy state into the structure instead of a flag

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

Modified: MacRuby/trunk/re.c
===================================================================
--- MacRuby/trunk/re.c	2011-01-03 12:55:53 UTC (rev 5107)
+++ MacRuby/trunk/re.c	2011-01-03 23:14:14 UTC (rev 5108)
@@ -41,10 +41,10 @@
     VALUE str;
     rb_match_result_t *results;
     int results_count;
+    bool busy;
 } rb_match_t;
 
 #define RMATCH(o) ((rb_match_t *)o)
-#define MATCH_BUSY FL_USER2
 
 static rb_regexp_t *
 regexp_alloc(VALUE klass, SEL sel)
@@ -65,6 +65,7 @@
     match->str = 0;
     match->results = NULL;
     match->results_count = 0;
+    match->busy = false;
     return match;
 }
 
@@ -202,6 +203,7 @@
 	// of -1 which indicates it's terminated by \0.
 	chars = &null_char;
 	chars_len = -1;
+	need_free = false;
     }
     else {
 	sanitize_regexp_string(&chars, &chars_len, &need_free);
@@ -722,6 +724,7 @@
 	// of -1 which indicates it's terminated by \0.
 	chars = &null_char;
 	chars_len = -1;
+	need_free = false;
     }
 
     uregex_setText(match_pattern, chars, chars_len, &status);
@@ -808,7 +811,7 @@
     rb_match_result_t *res = NULL;
 
     VALUE match = rb_backref_get();
-    if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
+    if (NIL_P(match) || RMATCH(match)->busy) {
 	// Creating a new Match object.
 	match = (VALUE)match_alloc(rb_cMatch, 0);
 	rb_backref_set(match);
@@ -2203,7 +2206,9 @@
 void
 rb_match_busy(VALUE match)
 {
-    FL_SET(match, MATCH_BUSY);
+    if (match != Qnil) {
+	RMATCH(match)->busy = true;
+    }
 }
 
 int
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110103/ae145e82/attachment.html>


More information about the macruby-changes mailing list