ext/rjb.c in rjb-1.6.7 vs ext/rjb.c in rjb-1.6.8
- old
+ new
@@ -12,11 +12,11 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
-#define RJB_VERSION "1.6.7"
+#define RJB_VERSION "1.6.8"
#include "ruby.h"
#include "extconf.h"
#if RJB_RUBY_VERSION_CODE < 190
#include "st.h"
@@ -62,10 +62,14 @@
#define CLASS_INHERITED(spr, kls) RTEST(rb_funcall(spr, rb_intern(">="), 1, kls))
#endif
#define IS_RJB_OBJECT(v) (CLASS_INHERITED(rjbi, rb_obj_class(v)) || rb_obj_class(v) == rjb || CLASS_INHERITED(rjbb, rb_obj_class(v)))
#define USER_INITIALIZE "@user_initialize"
+#if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
+static void rb_undef_alloc_func(v) {}
+#endif
+
static void register_class(VALUE, VALUE);
static VALUE import_class(JNIEnv* jenv, jclass, VALUE);
static VALUE register_instance(JNIEnv* jenv, VALUE klass, struct jv_data*, jobject);
static VALUE rjb_s_free(struct jv_data*);
static VALUE rjb_class_forname(int argc, VALUE* argv, VALUE self);
@@ -2093,10 +2097,11 @@
{
*pclsname = '_';
}
}
rexp = rb_define_class_under(rjb, nm, rjbc);
+ rb_undef_alloc_func(rexp);
ptr = ALLOC(struct jv_data);
memset(ptr, 0, sizeof(struct jv_data));
v = Data_Wrap_Struct(rexp, NULL, rjb_s_free, ptr);
ptr->idata.obj = (*jenv)->NewGlobalRef(jenv, jcls);
setup_metadata(jenv, v, ptr, clsname);
@@ -3331,18 +3336,20 @@
rb_define_method(rjbc, "_invoke", rjb_invoke, -1);
rb_define_method(rjbc, "_classname", rjb_i_class, 0);
/* Java instance object */
rjbi = CLASS_NEW(rb_cObject, "Rjb_JavaProxy");
+ rb_undef_alloc_func(rjbi);
rb_gc_register_address(&rjbi);
rb_define_method(rjbi, "method_missing", rjb_i_missing, -1);
rb_define_method(rjbi, "_invoke", rjb_i_invoke, -1);
rb_define_method(rjbi, "_classname", rjb_i_class, 0);
rb_define_method(rjbi, "_prepare_proxy", rjb_i_prepare_proxy, 0);
rb_define_alias(rjbi, "include", "extend");
/* Ruby-Java Bridge object */
rjbb = CLASS_NEW(rb_cObject, "Rjb_JavaBridge");
+ rb_undef_alloc_func(rjbb);
rb_gc_register_address(&rjbb);
/* anonymous interface object */
rjba = CLASS_NEW(rb_cObject, "Rjb_AnonymousClass");
rb_gc_register_address(&rjba);