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 | 363879668437b3beea6241165204868ed50ce270 (patch) | |
| tree | de1755b4e93ee6142ee1aa233b83f1921e50f817 /string.c | |
| parent | 9cda1ed2c321f61a356d9c8d1cb6033f4a41ff42 (diff) | |
| download | ruby-363879668437b3beea6241165204868ed50ce270.tar.gz ruby-363879668437b3beea6241165204868ed50ce270.tar.xz ruby-363879668437b3beea6241165204868ed50ce270.zip | |
* string.c (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when
empty string (len == 0).
git-svn-id: http://svn.ruby-lang.org/repos/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); |
