Project

General

Profile

Feature #13252 ยป out.diff

tenderlovemaking (Aaron Patterson), 02/25/2017 12:19 AM

View differences:

string.c
}
static VALUE
str_new_static(VALUE klass, const char *ptr, long len, int encindex)
str_new_with_buf(VALUE klass, const char *ptr, long len, int encindex)
{
VALUE str;
......
RSTRING(str)->as.heap.ptr = (char *)ptr;
RSTRING(str)->as.heap.aux.capa = len;
STR_SET_NOEMBED(str);
RBASIC(str)->flags |= STR_NOFREE;
}
rb_enc_associate_index(str, encindex);
return str;
}
static VALUE
str_new_static(VALUE klass, const char *ptr, long len, int encindex)
{
VALUE str = str_new_with_buf(klass, ptr, len, encindex);
if (ptr) {
RBASIC(str)->flags |= STR_NOFREE;
}
return str;
}
VALUE
rb_str_new_static(const char *ptr, long len)
{
......
}
VALUE
rb_str_new_with_buf(const char *ptr, long len)
{
return str_new_with_buf(rb_cString, ptr, len, 0);
}
VALUE
rb_usascii_str_new_with_buf(const char *ptr, long len)
{
return str_new_with_buf(rb_cString, ptr, len, ENCINDEX_US_ASCII);
}
VALUE
rb_utf8_str_new_with_buf(const char *ptr, long len)
{
return str_new_with_buf(rb_cString, ptr, len, ENCINDEX_UTF_8);
}
VALUE
rb_enc_str_new_with_buf(const char *ptr, long len, rb_encoding *enc)
{
return str_new_with_buf(rb_cString, ptr, len, rb_enc_to_index(enc));
}
VALUE
rb_tainted_str_new(const char *ptr, long len)
{
VALUE str = rb_str_new(ptr, len);
    (1-1/1)