From fde6a92197d3c0b646f19e443d4618ac47044fff Mon Sep 17 00:00:00 2001 From: Carsten Teibes Date: Fri, 18 Aug 2017 19:45:57 +0200 Subject: [PATCH] Fix deprecation warning on build with MRI>2.3 Fixes #158. The old alias is deprecated since: ruby/ruby@fdb957925f2f. --- binding-mri/binding-util.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/binding-mri/binding-util.h b/binding-mri/binding-util.h index 83589f7..1b758be 100644 --- a/binding-mri/binding-util.h +++ b/binding-mri/binding-util.h @@ -67,7 +67,7 @@ raiseRbExc(const Exception &exc); /* 2.1 has added a new field (flags) to rb_data_type_t */ #include -#if RUBY_API_VERSION_MINOR > 0 +#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 1 /* TODO: can mkxp use RUBY_TYPED_FREE_IMMEDIATELY here? */ #define DEF_TYPE_FLAGS 0 #else @@ -90,7 +90,12 @@ raiseRbExc(const Exception &exc); template static VALUE classAllocate(VALUE klass) { +/* 2.3 has changed the name of this function */ +#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 3 + return rb_data_typed_object_wrap(klass, 0, rbType); +#else return rb_data_typed_object_alloc(klass, 0, rbType); +#endif } template