1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c, include/ruby/intern.h: export rb_str_length().

* insns.def: use rb_str_lengt() in opt_length.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-08-25 08:54:29 +00:00
parent c2a734ea99
commit 5ba27573a0
4 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,9 @@
Sat Aug 25 17:52:06 2007 Koichi Sasada <ko1@atdot.net>
* 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@atdot.net>
* cont.c: rename FIBER_STACK_SIZE to FIBER_VM_STACK_SIZE.

View file

@ -520,6 +520,7 @@ VALUE rb_str_associated(VALUE);
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*, ...);

View file

@ -1951,11 +1951,11 @@ opt_length
{
if (!SPECIAL_CONST_P(recv) &&
BASIC_OP_UNREDEFINED_P(BOP_LENGTH)) {
if (HEAP_CLASS_OF(recv) == rb_cArray) {
val = LONG2NUM(RARRAY_LEN(recv));
if (HEAP_CLASS_OF(recv) == rb_cString) {
val = rb_str_length(recv);
}
else if (HEAP_CLASS_OF(recv) == rb_cString) {
val = LONG2NUM(RSTRING_LEN(recv));
else if (HEAP_CLASS_OF(recv) == rb_cArray) {
val = LONG2NUM(RARRAY_LEN(recv));
}
else if (HEAP_CLASS_OF(recv) == rb_cHash) {
val = INT2FIX(RHASH(recv)->tbl->num_entries);

View file

@ -421,7 +421,7 @@ str_strlen(VALUE str, rb_encoding *enc)
* Returns the character length of <i>str</i>.
*/
static VALUE
VALUE
rb_str_length(VALUE str)
{
int len;