Skip to content

Commit 576ddc3

Browse files
authored
Replace deprecated Data_Wrap_Struct with TypedData API (#4)
1 parent 3ed4844 commit 576ddc3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

ext/glamour/extension.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,18 @@ static VALUE glamour_version_rb(VALUE self) {
178178

179179
/* Renderer class methods */
180180

181+
static const rb_data_type_t renderer_data_type = {
182+
.wrap_struct_name = "Glamour::Renderer",
183+
.function = {
184+
.dmark = NULL,
185+
.dfree = NULL,
186+
.dsize = NULL,
187+
},
188+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
189+
};
190+
181191
static VALUE renderer_alloc(VALUE klass) {
182-
return Data_Wrap_Struct(klass, NULL, NULL, NULL);
192+
return TypedData_Wrap_Struct(klass, &renderer_data_type, NULL);
183193
}
184194

185195
static VALUE renderer_initialize(int argc, VALUE *argv, VALUE self) {

0 commit comments

Comments
 (0)