summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-28 03:04:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-28 03:04:21 +0000
commit8ac2f3572eb062c45f8eba3822fb51271a47ace8 (patch)
tree1651ef37b44bf97d327e71114c829221ea16be61 /string.c
parent7f7cb6f00b12bd8ec660e576e3d34aa609062897 (diff)
downloadruby-8ac2f3572eb062c45f8eba3822fb51271a47ace8.tar.gz
ruby-8ac2f3572eb062c45f8eba3822fb51271a47ace8.tar.xz
ruby-8ac2f3572eb062c45f8eba3822fb51271a47ace8.zip
* string.c (str_new): sets empty string to coderange 7bit.
[ruby-core:18993] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string.c b/string.c
index 990694f24..7d6f30555 100644
--- a/string.c
+++ b/string.c
@@ -395,6 +395,9 @@ str_new(VALUE klass, const char *ptr, long len)
RSTRING(str)->as.heap.ptr = ALLOC_N(char,len+1);
STR_SET_NOEMBED(str);
}
+ else if (len == 0) {
+ ENC_CODERANGE_SET(str, ENC_CODERANGE_7BIT);
+ }
if (ptr) {
memcpy(RSTRING_PTR(str), ptr, len);
}