diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-26 00:18:50 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-26 00:18:50 +0000 |
commit | df17bd4313558b5ff79c48969dec2d30584f3091 (patch) | |
tree | de1755b4e93ee6142ee1aa233b83f1921e50f817 /string.c | |
parent | 2160c40fb2ef40e8a7ad593239fac3558e2639f1 (diff) |
* string.c (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when
empty string (len == 0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -278,7 +278,7 @@ str_new(VALUE klass, const char *ptr, long len) if (ptr) { memcpy(RSTRING_PTR(str), ptr, len); } - else { + if (len == 0) { ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT); } STR_SET_LEN(str, len); |