[macruby-changes] [2026] MacRuby/branches/experimental/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 15 09:22:03 PDT 2009
Revision: 2026
http://trac.macosforge.org/projects/ruby/changeset/2026
Author: pthomson at apple.com
Date: 2009-07-15 09:22:03 -0700 (Wed, 15 Jul 2009)
Log Message:
-----------
Implemented ByteString#bytesize.
Modified Paths:
--------------
MacRuby/branches/experimental/string.c
Modified: MacRuby/branches/experimental/string.c
===================================================================
--- MacRuby/branches/experimental/string.c 2009-07-15 01:15:47 UTC (rev 2025)
+++ MacRuby/branches/experimental/string.c 2009-07-15 16:22:03 UTC (rev 2026)
@@ -5444,6 +5444,11 @@
return Qnil;
}
+static VALUE
+rb_bytestring_bytesize(VALUE bstr, SEL sel)
+{
+ return LONG2NUM(CFDataGetLength(rb_bytestring_wrapped_data(bstr)));
+}
static UniChar
imp_rb_bytestring_characterAtIndex(void *rcv, SEL sel, CFIndex idx)
@@ -5697,6 +5702,7 @@
rb_bytestring_initialize, -1);
rb_objc_define_method(*(VALUE *)rb_cByteString, "alloc",
rb_bytestring_alloc, 0);
+ rb_objc_define_method(rb_cByteString, "bytesize", rb_bytestring_bytesize, 0);
rb_objc_define_method(rb_cByteString, "getbyte", rb_bytestring_getbyte, 1);
rb_objc_define_method(rb_cByteString, "setbyte", rb_bytestring_setbyte, 2);
wrappedDataOffset = ivar_getOffset(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090715/3decc779/attachment.html>
More information about the macruby-changes
mailing list