[macruby-changes] [3607] MacRuby/branches/icu/re.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 24 15:05:41 PST 2010
Revision: 3607
http://trac.macosforge.org/projects/ruby/changeset/3607
Author: lsansonetti at apple.com
Date: 2010-02-24 15:05:40 -0800 (Wed, 24 Feb 2010)
Log Message:
-----------
honor invalid/empty groups
Modified Paths:
--------------
MacRuby/branches/icu/re.cpp
Modified: MacRuby/branches/icu/re.cpp
===================================================================
--- MacRuby/branches/icu/re.cpp 2010-02-24 22:46:02 UTC (rev 3606)
+++ MacRuby/branches/icu/re.cpp 2010-02-24 23:05:40 UTC (rev 3607)
@@ -1212,9 +1212,12 @@
}
const int beg = RMATCH(match)->results[nth].beg;
- const int len = RMATCH(match)->results[nth].end - beg;
+ const int end = RMATCH(match)->results[nth].end;
+ if (beg == -1 || end == -1) {
+ return Qnil;
+ }
- return unistr_subseq(RMATCH(match)->unistr, beg, len);
+ return unistr_subseq(RMATCH(match)->unistr, beg, end - beg);
}
VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100224/0b5b3ee8/attachment.html>
More information about the macruby-changes
mailing list