Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11859 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-02-13 15:06:26 +00:00
commit 12b89ff406
4 changed files with 20 additions and 22 deletions

View file

@ -118,13 +118,11 @@
static VALUE from(const std::pair<T,U>& val) {
VALUE obj = rb_ary_new2(2);
RARRAY_PTR(obj)[0] = swig::from<
typename swig::noconst_traits<T >::noconst_type>(val.first);
RARRAY_PTR(obj)[1] = swig::from(val.second);
RARRAY_LEN(obj) = 2;
rb_define_singleton_method(obj, "second",
rb_ary_push(obj, swig::from<typename swig::noconst_traits<T >::noconst_type>(val.first));
rb_ary_push(obj, swig::from(val.second));
rb_define_singleton_method(obj, "second",
VALUEFUNC(_wrap_pair_second), 0 );
rb_define_singleton_method(obj, "second=",
rb_define_singleton_method(obj, "second=",
VALUEFUNC(_wrap_pair_second_eq), 1 );
rb_obj_freeze(obj); // treat as immutable tuple
return obj;