summaryrefslogtreecommitdiff
path: root/eval_method.ci
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-08 15:07:18 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-08 15:07:18 +0000
commit2a37152f3fa3cd90f786c581dcc8d93b6279c288 (patch)
tree05df36c5ce7f88ce0b9e88b062636d7581879aa0 /eval_method.ci
parent22bcf22ea4ed3a49c497679c5fa82b6542787a47 (diff)
* eval_method.ci (rb_get_alloc_func): new function to get allocation
function. * include/ruby/intern.h (rb_alloc_func_t): declared. (rb_define_alloc_func): declared. (rb_marshal_define_compat): declared. * range.c: use T_STRUCT for Range. * inits.c: move Init_marshal() prior to Init_Range() because Init_Range calls rb_marshal_define_compat which needs marshal's compat_allocator_tbl initialized. * marshal.c: support marshal format compatibility layer designed for marshaling T_STRUCT Range using T_OBJECT format. (rb_marshal_define_compat): defined. [ruby-dev:31710] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_method.ci')
-rw-r--r--eval_method.ci13
1 files changed, 13 insertions, 0 deletions
diff --git a/eval_method.ci b/eval_method.ci
index 5a30596198..08ba953374 100644
--- a/eval_method.ci
+++ b/eval_method.ci
@@ -192,6 +192,19 @@ rb_undef_alloc_func(VALUE klass)
rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, 0, NOEX_UNDEF);
}
+rb_alloc_func_t
+rb_get_alloc_func(VALUE klass)
+{
+ NODE *n;
+ Check_Type(klass, T_CLASS);
+ n = rb_method_node(CLASS_OF(klass), ID_ALLOCATOR);
+ if (!n) return 0;
+ if (nd_type(n) != NODE_METHOD) return 0;
+ n = n->nd_body;
+ if (nd_type(n) != NODE_CFUNC) return 0;
+ return n->nd_cfnc;
+}
+
static NODE *
search_method(VALUE klass, ID id, VALUE *klassp)
{