diff options
Diffstat (limited to 'ext/-test-/bug-3652/bug.c')
-rw-r--r-- | ext/-test-/bug-3652/bug.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/-test-/bug-3652/bug.c b/ext/-test-/bug-3652/bug.c new file mode 100644 index 0000000000..290ac2ddee --- /dev/null +++ b/ext/-test-/bug-3652/bug.c @@ -0,0 +1,16 @@ +#include <ruby.h> + +static VALUE +bug_str_resize(VALUE self, VALUE init, VALUE repl) +{ + long initlen = NUM2LONG(init); + VALUE s = rb_str_buf_new(initlen); + return rb_str_resize(s, strlcpy(RSTRING_PTR(s), StringValueCStr(repl), (size_t)initlen)); +} + +void +Init_bug(void) +{ + VALUE mBug = rb_define_module("Bug"); + rb_define_module_function(mBug, "str_resize", bug_str_resize, 2); +} |