diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-23 08:41:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-23 08:41:07 +0000 |
commit | 1d3bc61320a7628bc4e60c70880656867c22dc10 (patch) | |
tree | 25516e057647a261ce2521cbafd60ec582892eb3 /string.c | |
parent | 27e0e993ff535d2fbd1dc412c1748d83ac147a69 (diff) | |
download | ruby-1d3bc61320a7628bc4e60c70880656867c22dc10.tar.gz ruby-1d3bc61320a7628bc4e60c70880656867c22dc10.tar.xz ruby-1d3bc61320a7628bc4e60c70880656867c22dc10.zip |
* dir.c (find_dirsep): get rid of warnings.
* eval.c (error_print): temporary value might be disposed by GC.
* hash.c (env_has_value, env_index): should not increment NULL.
* io.c (io_read, rb_io_sysread): not read when length is 0.
* io.c (rb_io_reopen): ensure initialized IO.
* io.c (rb_io_init_copy): sychronize file pointer.
* io.c (rb_io_s_pipe): make exception proof.
* string.c (rb_str_rindex_m): Fixnum 0 matched end of string.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -451,18 +451,6 @@ VALUE rb_string_value(ptr) volatile VALUE *ptr; { - *ptr = rb_str_to_str(*ptr); - if (!RSTRING(*ptr)->ptr) { - FL_SET(*ptr, ELTS_SHARED); - RSTRING(*ptr)->ptr = null_str; - } - return *ptr; -} - -char * -rb_string_value_ptr(ptr) - volatile VALUE *ptr; -{ VALUE s = *ptr; if (TYPE(s) != T_STRING) { s = rb_str_to_str(s); @@ -472,7 +460,14 @@ rb_string_value_ptr(ptr) FL_SET(s, ELTS_SHARED); RSTRING(s)->ptr = null_str; } - return RSTRING(s)->ptr; + return s; +} + +char * +rb_string_value_ptr(ptr) + volatile VALUE *ptr; +{ + return RSTRING(rb_string_value(s))->ptr; } VALUE @@ -1015,9 +1010,8 @@ rb_str_rindex_m(argc, argv, str) char *p = RSTRING(str)->ptr + pos; char *pbeg = RSTRING(str)->ptr; - while (pbeg <= p) { + while (pbeg <= --p) { if (*p == c) return LONG2NUM(p - RSTRING(str)->ptr); - p--; } return Qnil; } |