From 52e721592fc2f9bcb55cfbbd7002ae0ff7003338 Mon Sep 17 00:00:00 2001 From: yugui Date: Mon, 4 May 2009 12:29:55 +0000 Subject: merges r23159 from trunk into ruby_1_9_1. -- * 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/branches/ruby_1_9_1@23333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 8c919ec100..1603354391 100644 --- a/string.c +++ b/string.c @@ -6070,7 +6070,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; -- cgit v1.2.3