2017-12-02 02:09:16 -05:00
|
|
|
#include "ruby.h"
|
|
|
|
#include "ruby/encoding.h"
|
|
|
|
|
2017-12-02 10:41:08 -05:00
|
|
|
static VALUE
|
2017-12-02 02:09:16 -05:00
|
|
|
bug_str_buf_new(VALUE self, VALUE len)
|
|
|
|
{
|
|
|
|
return rb_str_buf_new(NUM2LONG(len));
|
|
|
|
}
|
|
|
|
|
2017-12-02 10:41:08 -05:00
|
|
|
static VALUE
|
2017-12-02 02:09:16 -05:00
|
|
|
bug_external_str_new(VALUE self, VALUE len, VALUE enc)
|
|
|
|
{
|
|
|
|
return rb_external_str_new_with_enc(NULL, NUM2LONG(len), rb_to_encoding(enc));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-12-03 03:02:56 -05:00
|
|
|
Init_string_new(VALUE klass)
|
2017-12-02 02:09:16 -05:00
|
|
|
{
|
|
|
|
rb_define_singleton_method(klass, "buf_new", bug_str_buf_new, 1);
|
|
|
|
rb_define_singleton_method(klass, "external_new", bug_external_str_new, 2);
|
|
|
|
}
|