VALUE rbgobj_make_boxed(gpointer p, GType gtype) { const RGObjClassInfo* cinfo; VALUE result; boxed_holder* holder; if (!p) return Qnil; cinfo = GTYPE2CINFO(gtype); result = rbgobj_boxed_s_allocate(cinfo->klass); Data_Get_Struct(result, boxed_holder, holder); if (cinfo->flags & RBGOBJ_BOXED_NOT_COPY){ holder->boxed = p; holder->own = FALSE; } else { holder->boxed = g_boxed_copy(gtype, p); holder->own = TRUE; } return result; }
VALUE rbgobj_make_boxed_raw(gpointer p, GType gtype, VALUE klass, gint flags) { VALUE result; boxed_holder *holder; result = rbgobj_boxed_s_allocate(klass); Data_Get_Struct(result, boxed_holder, holder); if (flags & RBGOBJ_BOXED_NOT_COPY) { holder->boxed = p; holder->own = FALSE; } else { holder->boxed = g_boxed_copy(gtype, p); holder->own = TRUE; } return result; }
/* deprecated */ VALUE rbgobj_boxed_create(VALUE klass) { return rbgobj_boxed_s_allocate(klass); }