Feature #4893 » String_call_initialize_v3.diff
"b/C:\\Users\\LAZARI~1\\AppData\\Local\\Temp\\str186F.c" | ||
---|---|---|
return str;
|
||
}
|
||
#define FL_CALL_INIT FL_USER18
|
||
VALUE
|
||
rb_str_call_initialize_get(VALUE self)
|
||
{
|
||
if (FL_TEST(rb_cString, FL_CALL_INIT)) return Qtrue;
|
||
return Qfalse;
|
||
}
|
||
VALUE
|
||
rb_str_call_initialize_set(VALUE self, VALUE val)
|
||
{
|
||
FL_UNSET(rb_cString, FL_CALL_INIT);
|
||
if (val == Qtrue) FL_SET(rb_cString, FL_CALL_INIT);
|
||
|
||
return self;
|
||
}
|
||
VALUE
|
||
rb_str_new(const char *ptr, long len)
|
||
{
|
||
return str_new(rb_cString, ptr, len);
|
||
VALUE str;
|
||
VALUE argv[1];
|
||
str = str_new(rb_cString, ptr, len);
|
||
if (FL_TEST(rb_cString, FL_CALL_INIT)) {
|
||
argv[0] = (VALUE)str;
|
||
rb_obj_call_init((VALUE)str, 1, argv);
|
||
}
|
||
return str;
|
||
}
|
||
VALUE
|
||
... | ... | |
CHECK_IF_ASCII(c);
|
||
t += tlen;
|
||
}
|
||
if (!STR_EMBED_P(str)) {
|
||
xfree(RSTRING(str)->as.heap.ptr);
|
||
}
|
||
*t = '\0';
|
||
RSTRING(str)->as.heap.ptr = buf;
|
||
RSTRING(str)->as.heap.len = t - buf;
|
||
... | ... | |
rb_cString = rb_define_class("String", rb_cObject);
|
||
rb_include_module(rb_cString, rb_mComparable);
|
||
rb_define_alloc_func(rb_cString, str_alloc);
|
||
rb_define_singleton_method(rb_cString, "call_initialize", rb_str_call_initialize_get, 0);
|
||
rb_define_singleton_method(rb_cString, "call_initialize=", rb_str_call_initialize_set, 1);
|
||
rb_define_singleton_method(rb_cString, "try_convert", rb_str_s_try_convert, 1);
|
||
rb_define_method(rb_cString, "initialize", rb_str_init, -1);
|
||
rb_define_method(rb_cString, "initialize_copy", rb_str_replace, 1);
|