mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Treat NULL fake string as an empty string
And the NULL string must be of size 0.
This commit is contained in:
parent
21fd83a823
commit
edf01d4e82
1 changed files with 5 additions and 0 deletions
5
string.c
5
string.c
|
@ -413,6 +413,11 @@ setup_fake_str(struct RString *fake_str, const char *name, long len, int encidx)
|
||||||
fake_str->basic.flags = T_STRING|RSTRING_NOEMBED|STR_NOFREE|STR_FAKESTR;
|
fake_str->basic.flags = T_STRING|RSTRING_NOEMBED|STR_NOFREE|STR_FAKESTR;
|
||||||
/* SHARED to be allocated by the callback */
|
/* SHARED to be allocated by the callback */
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
RUBY_ASSERT_ALWAYS(len == 0);
|
||||||
|
name = "";
|
||||||
|
}
|
||||||
|
|
||||||
ENCODING_SET_INLINED((VALUE)fake_str, encidx);
|
ENCODING_SET_INLINED((VALUE)fake_str, encidx);
|
||||||
|
|
||||||
RBASIC_SET_CLASS_RAW((VALUE)fake_str, rb_cString);
|
RBASIC_SET_CLASS_RAW((VALUE)fake_str, rb_cString);
|
||||||
|
|
Loading…
Add table
Reference in a new issue