summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-26 00:18:50 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-26 00:18:50 +0000
commit363879668437b3beea6241165204868ed50ce270 (patch)
treede1755b4e93ee6142ee1aa233b83f1921e50f817 /string.c
parent9cda1ed2c321f61a356d9c8d1cb6033f4a41ff42 (diff)
downloadruby-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 684f88025..94c919787 100644
--- a/string.c
+++ b/string.c
@@ -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);