1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

string.c: term fill

* string.c (rb_str_chop_bang): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-10 07:48:56 +00:00
parent c77efe1144
commit ed94c24944
2 changed files with 5 additions and 1 deletions

View file

@ -7024,7 +7024,7 @@ rb_str_chop_bang(VALUE str)
long len;
len = chopped_length(str);
STR_SET_LEN(str, len);
RSTRING_PTR(str)[len] = '\0';
TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str));
if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
ENC_CODERANGE_CLEAR(str);
}

View file

@ -52,6 +52,10 @@ class Test_StringCStr < Test::Unit::TestCase
assert_wchars_term_char("a\n") {|s| s.chop!}
end
def test_wchar_chomp!
assert_wchars_term_char("a\n") {|s| s.chomp!}
end
def assert_wchars_term_char(str)
result = {}
WCHARS.map do |enc|