summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-08 13:22:28 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-08 13:22:28 +0000
commit872f9a498fb5ec52eb54b8ee1f546b0d50817779 (patch)
tree5b035cce8c04a59d43e38945f40cee68ccd3b5d8
parent5eb73eeda81b63d3d9d219b36bfd98dc27671a13 (diff)
* string.c: Revert previous commit (possibility of endless loop).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--string.c11
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d2e134a815..75f3be93417 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jun 8 22:22:24 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * string.c: Revert previous commit (possibility of endless loop).
+
Wed Jun 8 21:57:41 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c: Special-case :ascii option in rb_str_upcase_bang.
diff --git a/string.c b/string.c
index a8d06be52d1..e1cedf42aae 100644
--- a/string.c
+++ b/string.c
@@ -5871,6 +5871,7 @@ static VALUE
rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
{
rb_encoding *enc;
+ int modify = 0;
OnigCaseFoldType flags = ONIGENC_CASE_UPCASE;
flags = check_case_options(argc, argv, flags);
@@ -5886,17 +5887,17 @@ rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
if (rb_enc_isascii(c, enc) && 'a' <= c && c <= 'z') {
*s = 'A' + (c - 'a');
- flags |= ONIGENC_CASE_MODIFIED;
+ modify = 1;
}
s++;
}
}
- else if (flags&ONIGENC_CASE_ASCII_ONLY)
- rb_str_ascii_casemap(str, &flags, enc);
- else
+ else {
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
+ modify = ONIGENC_CASE_MODIFIED & flags;
+ }
- if (ONIGENC_CASE_MODIFIED&flags) return str;
+ if (modify) return str;
return Qnil;
}