mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_succ): reverted previous changes. [ruby-dev:35389]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8e34a3d9c0
commit
3cc0976f7a
2 changed files with 6 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Jul 9 22:11:37 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_succ): reverted previous changes. [ruby-dev:35389]
|
||||
|
||||
Wed Jul 9 20:58:16 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* array.c (rb_ary_fill): don't raise even if length is negative.
|
||||
|
|
14
string.c
14
string.c
|
@ -1401,7 +1401,7 @@ rb_str_succ(orig)
|
|||
VALUE orig;
|
||||
{
|
||||
VALUE str;
|
||||
char *sbeg, *s, *last_alnum = 0;
|
||||
char *sbeg, *s;
|
||||
int c = -1;
|
||||
long n = 0;
|
||||
|
||||
|
@ -1413,15 +1413,6 @@ rb_str_succ(orig)
|
|||
|
||||
while (sbeg <= s) {
|
||||
if (ISALNUM(*s)) {
|
||||
if (last_alnum && last_alnum > s + 1) {
|
||||
if (ISALPHA(*last_alnum) ? ISDIGIT(*s) :
|
||||
ISDIGIT(*last_alnum) ? ISALPHA(*s) : 0) {
|
||||
s = last_alnum;
|
||||
n = s - sbeg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
last_alnum = s;
|
||||
if ((c = succ_char(s)) == 0) break;
|
||||
n = s - sbeg;
|
||||
}
|
||||
|
@ -1434,9 +1425,8 @@ rb_str_succ(orig)
|
|||
if ((*s += 1) != 0) break;
|
||||
s--;
|
||||
}
|
||||
c = 0;
|
||||
}
|
||||
if (s < sbeg || c > 0) {
|
||||
if (s < sbeg) {
|
||||
RESIZE_CAPA(str, RSTRING(str)->len + 1);
|
||||
s = RSTRING(str)->ptr + n;
|
||||
memmove(s+1, s, RSTRING(str)->len - n);
|
||||
|
|
Loading…
Add table
Reference in a new issue