diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-10-10 07:03:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-10-10 07:03:36 +0000 |
commit | 7c763fa26c7b220e6307448d4bc5fb8143bf68cd (patch) | |
tree | 79c663a365cc039f46e51658f288538eade86658 /string.c | |
parent | 3a383015bd6b06b2ed9c0bd0425c55031eae137e (diff) | |
download | ruby-7c763fa26c7b220e6307448d4bc5fb8143bf68cd.tar.gz ruby-7c763fa26c7b220e6307448d4bc5fb8143bf68cd.tar.xz ruby-7c763fa26c7b220e6307448d4bc5fb8143bf68cd.zip |
matz
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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; } |