From c8aaf31fdd06df05c8c58df3d312280c5a02fc09 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 5 Jan 2011 20:10:59 +0000 Subject: * array.c (rb_ary_resize): new utility function. [ruby-dev:42912] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/array/resize/extconf.rb | 1 + ext/-test-/array/resize/resize.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 ext/-test-/array/resize/extconf.rb create mode 100644 ext/-test-/array/resize/resize.c (limited to 'ext/-test-/array') diff --git a/ext/-test-/array/resize/extconf.rb b/ext/-test-/array/resize/extconf.rb new file mode 100644 index 0000000000..6500a878fc --- /dev/null +++ b/ext/-test-/array/resize/extconf.rb @@ -0,0 +1 @@ +create_makefile("-test-/array/resize") diff --git a/ext/-test-/array/resize/resize.c b/ext/-test-/array/resize/resize.c new file mode 100644 index 0000000000..b3e6c751ba --- /dev/null +++ b/ext/-test-/array/resize/resize.c @@ -0,0 +1,14 @@ +#include "ruby/ruby.h" + +static VALUE +ary_resize(VALUE ary, VALUE len) +{ + rb_ary_resize(ary, NUM2LONG(len)); + return ary; +} + +void +Init_resize(void) +{ + rb_define_method(rb_cArray, "resize", ary_resize, 1); +} -- cgit v1.2.3