[macruby-changes] [3568] MacRuby/branches/icu/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 16 21:16:02 PST 2010
Revision: 3568
http://trac.macosforge.org/projects/ruby/changeset/3568
Author: lsansonetti at apple.com
Date: 2010-02-16 21:15:59 -0800 (Tue, 16 Feb 2010)
Log Message:
-----------
added 2 more compiler primitives
Modified Paths:
--------------
MacRuby/branches/icu/string.c
Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c 2010-02-17 05:10:45 UTC (rev 3567)
+++ MacRuby/branches/icu/string.c 2010-02-17 05:15:59 UTC (rev 3568)
@@ -1499,9 +1499,15 @@
RSTR(str)->length_in_bytes = len;
}
-// Compiler primitive.
+// Compiler primitives.
VALUE
+rb_str_new_empty(void)
+{
+ return (VALUE)str_alloc(rb_cRubyString);
+}
+
+VALUE
rb_unicode_str_new(const UniChar *ptr, const size_t len)
{
rb_str_t *str = str_alloc(rb_cRubyString);
@@ -1509,6 +1515,32 @@
return (VALUE)str;
}
+VALUE
+rb_str_new_fast(int argc, ...)
+{
+ VALUE str = (VALUE)str_alloc(rb_cRubyString);
+
+ if (argc > 0) {
+ va_list ar;
+ va_start(ar, argc);
+ for (int i = 0; i < argc; ++i) {
+ VALUE fragment = va_arg(ar, VALUE);
+ switch (TYPE(fragment)) {
+ default:
+ fragment = rb_obj_as_string(fragment);
+ // fall through
+
+ case T_STRING:
+ mr_str_concat(str, 0, fragment);
+ break;
+ }
+ }
+ va_end(ar);
+ }
+
+ return str;
+}
+
// MRI C-API compatibility.
VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100216/71ace5ca/attachment-0001.html>
More information about the macruby-changes
mailing list