From c492b9b0857a76a94db586c87e3ab5a270b20746 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 5 Sep 2003 05:07:54 +0000 Subject: * eval.c (mark_frame_adj): need to adjust argv pointer if using system's alloca. [ruby-core:01503] * io.c (rb_f_gets): should call next_argv() before type check current_file. [ruby-list:38336] * eval.c (proc_invoke): should retrieve retval when pcall is true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 248813e233..67f4f8dcc3 100644 --- a/string.c +++ b/string.c @@ -1807,16 +1807,16 @@ rb_str_reverse_bang(str) char *s, *e; char c; - if (RSTRING(str)->len <= 1) return Qnil; - rb_str_modify(str); - s = RSTRING(str)->ptr; - e = s + RSTRING(str)->len - 1; - while (s < e) { - c = *s; - *s++ = *e; - *e-- = c; + if (RSTRING(str)->len > 1) { + rb_str_modify(str); + s = RSTRING(str)->ptr; + e = s + RSTRING(str)->len - 1; + while (s < e) { + c = *s; + *s++ = *e; + *e-- = c; + } } - return str; } -- cgit v1.2.3