summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-20 06:57:51 +0000
committernari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-20 06:57:51 +0000
commitc3a46d6acab5ab063cc6b5808c2b344f110bef12 (patch)
tree60d786cb4c890e97fb4c314476dd21d0f0ae451d /gc.c
parentf1e488e5241f52765550a7e5e20d1d7509da5b32 (diff)
* include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags) #define NEWOBJ_OF(obj,type,klass,flags) These allow to change a allocation strategy depending on klass or flags. * gc.c: ditto * array.c: use new C API. * bignum.c: ditto * class.c: ditto * complex.c: ditto * ext/socket/ancdata.c: ditto * ext/socket/option.c: ditto * hash.c: ditto * io.c: ditto * marshal.c: ditto * numeric.c: ditto * object.c: ditto * random.c: ditto * range.c: ditto * rational.c: ditto * re.c: ditto * string.c: ditto * struct.c: ditto [Feature #7177][Feature #7047] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 735ae85baa..bd6477050d 100644
--- a/gc.c
+++ b/gc.c
@@ -646,8 +646,8 @@ heaps_increment(rb_objspace_t *objspace)
return FALSE;
}
-VALUE
-rb_newobj(void)
+static VALUE
+newobj(VALUE klass, VALUE flags)
{
rb_objspace_t *objspace = &rb_objspace;
VALUE obj;
@@ -688,6 +688,23 @@ rb_newobj(void)
return obj;
}
+VALUE
+rb_newobj(void)
+{
+ return newobj(0, T_NONE);
+}
+
+VALUE
+rb_newobj_of(VALUE klass, VALUE flags)
+{
+ VALUE obj;
+
+ obj = newobj(klass, flags);
+ OBJSETUP(obj, klass, flags);
+
+ return obj;
+}
+
NODE*
rb_node_newnode(enum node_type type, VALUE a0, VALUE a1, VALUE a2)
{