summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-07 15:23:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-07 15:23:01 +0000
commitf04db2b4cffc548a1e3b0a478ae75b12b24308b3 (patch)
tree194d27846f925141e2a9eca61338d18e630d61ee /string.c
parent82fe6d2be5eb5c7dc84a70150e52fb8a42cd5453 (diff)
* string.c (rb_str_succ): limit carrying in an alphanumeric region if
exists. [ruby-dev:35094] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/string.c b/string.c
index 615af97e67..4a37f213ab 100644
--- a/string.c
+++ b/string.c
@@ -1416,6 +1416,10 @@ rb_str_succ(orig)
if ((c = succ_char(s)) == 0) break;
n = s - sbeg;
}
+ else if (c != -1) {
+ n = ++s - sbeg;
+ break;
+ }
s--;
}
if (c == -1) { /* str contains no alnum */
@@ -1425,8 +1429,9 @@ rb_str_succ(orig)
if ((*s += 1) != 0) break;
s--;
}
+ c = 0;
}
- if (s < sbeg) {
+ if (s < sbeg || c > 0) {
RESIZE_CAPA(str, RSTRING(str)->len + 1);
s = RSTRING(str)->ptr + n;
memmove(s+1, s, RSTRING(str)->len - n);