[macruby-changes] [3556] MacRuby/branches/icu/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 16 14:56:46 PST 2010
Revision: 3556
http://trac.macosforge.org/projects/ruby/changeset/3556
Author: lsansonetti at apple.com
Date: 2010-02-16 14:56:46 -0800 (Tue, 16 Feb 2010)
Log Message:
-----------
more work
Modified Paths:
--------------
MacRuby/branches/icu/string.c
Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c 2010-02-16 22:44:14 UTC (rev 3555)
+++ MacRuby/branches/icu/string.c 2010-02-16 22:56:46 UTC (rev 3556)
@@ -1367,14 +1367,21 @@
// MRI C-API compatibility.
VALUE
-rb_str_new(const char *cstr, long len)
+rb_enc_str_new(const char *cstr, long len, rb_encoding_t *enc)
{
+ // XXX should we assert that enc is single byte?
rb_str_t *str = str_alloc();
- str_replace_with_bytes(str, cstr, len, ENCODING_BINARY);
+ str_replace_with_bytes(str, cstr, len, enc);
return (VALUE)str;
}
VALUE
+rb_str_new(const char *cstr, long len)
+{
+ return rb_enc_str_new(cstr, len, ENCODING_BINARY);
+}
+
+VALUE
rb_str_buf_new(long len)
{
return rb_str_new(NULL, len);
@@ -1548,11 +1555,11 @@
}
VALUE
-rb_str_buf_cat(VALUE str, const char *cstr, long len)
+rb_enc_str_buf_cat(VALUE str, const char *cstr, long len, rb_encoding_t *enc)
{
if (IS_RSTR(str)) {
// XXX this could be optimized
- VALUE substr = rb_str_new(cstr, len);
+ VALUE substr = rb_enc_str_new(cstr, len, enc);
str_concat_string(RSTR(str), RSTR(substr));
}
else {
@@ -1562,6 +1569,12 @@
}
VALUE
+rb_str_buf_cat(VALUE str, const char *cstr, long len)
+{
+ return rb_enc_str_buf_cat(str, cstr, len, ENCODING_BINARY);
+}
+
+VALUE
rb_str_buf_cat2(VALUE str, const char *cstr)
{
return rb_str_buf_cat(str, cstr, strlen(cstr));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100216/c98d7349/attachment.html>
More information about the macruby-changes
mailing list