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
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…
x
Reference in New Issue
Block a user