From 1ce6f065b519284a5ad7135a6db77fcbe1aa778a Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 10 Oct 2000 07:03:36 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/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 ff9e6bd0c2..46f9725ce3 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 v1.2.3