From 6a1101f23ea403a8825c2f361508eeb85878b011 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 21 Jun 2013 11:22:18 +0000 Subject: * include/ruby/ruby.h: support write barrier protection for T_STRUCT. Introduce the following C APIs: * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk). The type of returned pointer is (const VALUE *). * RSTRUCT_GET(st, idx) returns idx-th value of struct. * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB. And * RSTRUCT_PTR(st) returns pointer with shady operation. The type of returned pointer is (VALUE *). * struct.c, re.c, gc.c, marshal.c: rewrite with above APIs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index bd0cc0272b..6527a814f1 100644 --- a/gc.c +++ b/gc.c @@ -1283,7 +1283,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj) case T_STRUCT: if ((RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK) == 0 && RANY(obj)->as.rstruct.as.heap.ptr) { - xfree(RANY(obj)->as.rstruct.as.heap.ptr); + xfree((void *)RANY(obj)->as.rstruct.as.heap.ptr); } break; @@ -3386,7 +3386,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr) case T_STRUCT: { long len = RSTRUCT_LEN(obj); - VALUE *ptr = RSTRUCT_PTR(obj); + const VALUE *ptr = RSTRUCT_RAWPTR(obj); while (len--) { gc_mark(objspace, *ptr++); -- cgit v1.2.3