mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1.1b9_05_pre1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cdde29b924
commit
fbbd5539ae
10 changed files with 32 additions and 21 deletions
6
string.c
6
string.c
|
@ -1270,16 +1270,16 @@ static VALUE
|
|||
str_reverse_bang(str)
|
||||
VALUE str;
|
||||
{
|
||||
UCHAR *s, *e, *p;
|
||||
UCHAR *s, *e, *p, *q;
|
||||
|
||||
s = RSTRING(str)->ptr;
|
||||
e = s + RSTRING(str)->len - 1;
|
||||
p = ALLOCA_N(char, RSTRING(str)->len);
|
||||
p = q = ALLOCA_N(char, RSTRING(str)->len);
|
||||
|
||||
while (e >= s) {
|
||||
*p++ = *e--;
|
||||
}
|
||||
MEMCPY(RSTRING(str)->ptr, p, char, RSTRING(str)->len);
|
||||
MEMCPY(RSTRING(str)->ptr, q, char, RSTRING(str)->len);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue