| 1 |
#include "ruby.h" |
| 2 |
#include "ruby/encoding.h" |
| 3 |
|
| 4 |
static VALUE |
| 5 |
bug_str_buf_new(VALUE self, VALUE len) |
| 6 |
{ |
| 7 |
return rb_str_buf_new(NUM2LONG(len)); |
| 8 |
} |
| 9 |
|
| 10 |
static VALUE |
| 11 |
bug_external_str_new(VALUE self, VALUE len, VALUE enc) |
| 12 |
{ |
| 13 |
return rb_external_str_new_with_enc(NULL, NUM2LONG(len), rb_to_encoding(enc)); |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
Init_string_new(VALUE klass) |
| 18 |
{ |
| 19 |
rb_define_singleton_method(klass, "buf_new", bug_str_buf_new, 1); |
| 20 |
rb_define_singleton_method(klass, "external_new", bug_external_str_new, 2); |
| 21 |
} |