summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-08 11:08:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-08 11:08:18 +0000
commit6387c5dc8c3b67f289b47cd82111c106b08ff7bb (patch)
tree264d96422fa41253f0352d11d72cd6921a578930 /string.c
parentc9ad044dfb797efff78a17caccb64cbb72b4a552 (diff)
* string.c (rb_str_rstrip_bang): should not sign-expand non-ascii.
[ruby-core:23158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/string.c b/string.c
index 2744ea94b3..2b790a082f 100644
--- a/string.c
+++ b/string.c
@@ -6197,7 +6197,8 @@ rb_str_rstrip_bang(VALUE str)
/* remove trailing spaces or '\0's */
if (single_byte_optimizable(str)) {
- while (s < t && (*(t-1) == '\0' || rb_enc_isspace(*(t-1), enc))) t--;
+ unsigned char c;
+ while (s < t && ((c = *(t-1)) == '\0' || rb_enc_isspace(c, enc))) t--;
}
else {
char *tp;