ruby-changes:1780
From: ko1@a...
Date: 25 Aug 2007 17:55:00 +0900
Subject: [ruby-changes:1780] ko1 - Ruby:r13271 (trunk): * string.c, include/ruby/intern.h: export rb_str_length().
ko1 2007-08-25 17:54:29 +0900 (Sat, 25 Aug 2007) New Revision: 13271 Modified files: trunk/ChangeLog trunk/include/ruby/intern.h trunk/insns.def trunk/string.c Log: * string.c, include/ruby/intern.h: export rb_str_length(). * insns.def: use rb_str_lengt() in opt_length. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=13271&r2=13270 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13271&r2=13270 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/insns.def?r1=13271&r2=13270 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/intern.h?r1=13271&r2=13270 Index: include/ruby/intern.h =================================================================== --- include/ruby/intern.h (revision 13270) +++ include/ruby/intern.h (revision 13271) @@ -520,6 +520,7 @@ void rb_str_setter(VALUE, ID, VALUE*); VALUE rb_str_intern(VALUE); VALUE rb_sym_to_s(VALUE); +VALUE rb_str_length(VALUE); /* struct.c */ VALUE rb_struct_new(VALUE, ...); VALUE rb_struct_define(const char*, ...); Index: insns.def =================================================================== --- insns.def (revision 13270) +++ insns.def (revision 13271) @@ -1951,12 +1951,12 @@ { if (!SPECIAL_CONST_P(recv) && BASIC_OP_UNREDEFINED_P(BOP_LENGTH)) { - if (HEAP_CLASS_OF(recv) == rb_cArray) { + if (HEAP_CLASS_OF(recv) == rb_cString) { + val = rb_str_length(recv); + } + else if (HEAP_CLASS_OF(recv) == rb_cArray) { val = LONG2NUM(RARRAY_LEN(recv)); } - else if (HEAP_CLASS_OF(recv) == rb_cString) { - val = LONG2NUM(RSTRING_LEN(recv)); - } else if (HEAP_CLASS_OF(recv) == rb_cHash) { val = INT2FIX(RHASH(recv)->tbl->num_entries); } Index: ChangeLog =================================================================== --- ChangeLog (revision 13270) +++ ChangeLog (revision 13271) @@ -1,3 +1,9 @@ +Sat Aug 25 17:52:06 2007 Koichi Sasada <ko1@a...> + + * string.c, include/ruby/intern.h: export rb_str_length(). + + * insns.def: use rb_str_lengt() in opt_length. + Sat Aug 25 17:48:51 2007 Koichi Sasada <ko1@a...> * cont.c: rename FIBER_STACK_SIZE to FIBER_VM_STACK_SIZE. Index: string.c =================================================================== --- string.c (revision 13270) +++ string.c (revision 13271) @@ -421,7 +421,7 @@ * Returns the character length of <i>str</i>. */ -static VALUE +VALUE rb_str_length(VALUE str) { int len; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml