From 7c763fa26c7b220e6307448d4bc5fb8143bf68cd Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 10 Oct 2000 07:03:36 +0000 Subject: matz git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index ff9e6bd0c..46f9725ce 100644 --- a/string.c +++ b/string.c @@ -1381,16 +1381,16 @@ static VALUE rb_str_reverse_bang(str) VALUE str; { - char *s, *e, *p, *q; + char *s, *e; + char c; s = RSTRING(str)->ptr; e = s + RSTRING(str)->len - 1; - p = q = ALLOCA_N(char, RSTRING(str)->len); - - while (e >= s) { - *p++ = *e--; + while (s < e) { + c = *s; + *s++ = *e; + *e-- = c; } - MEMCPY(RSTRING(str)->ptr, q, char, RSTRING(str)->len); return str; } -- cgit