[macruby-changes] [2210] MacRuby/branches/experimental/re.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 4 16:25:00 PDT 2009
Revision: 2210
http://trac.macosforge.org/projects/ruby/changeset/2210
Author: vincent.isambart at gmail.com
Date: 2009-08-04 16:25:00 -0700 (Tue, 04 Aug 2009)
Log Message:
-----------
fixed Regexp.quote
Modified Paths:
--------------
MacRuby/branches/experimental/re.c
Modified: MacRuby/branches/experimental/re.c
===================================================================
--- MacRuby/branches/experimental/re.c 2009-08-04 10:05:18 UTC (rev 2209)
+++ MacRuby/branches/experimental/re.c 2009-08-04 23:25:00 UTC (rev 2210)
@@ -3118,7 +3118,7 @@
char *t_beg;
meta_found:
- t_beg = (char *)alloca(RSTRING_LEN(str) * 2);
+ t_beg = (char *)alloca(RSTRING_LEN(str) * 2 + 1);
t = t_beg;
/* copy upto metacharacter */
memcpy(t, RSTRING_PTR(str), s - RSTRING_PTR(str));
@@ -3163,8 +3163,10 @@
}
*t++ = c;
}
+ // rb_str_new wants a NULL-terminated string
+ *t = 0;
- return rb_str_new(t, t - t_beg);
+ return rb_str_new(t_beg, t - t_beg);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090804/8457dd55/attachment.html>
More information about the macruby-changes
mailing list