Skip to content

Commit 03ffa51

Browse files
committed
Add missing Ruby version guards for rb_data_define()'s specs
1 parent 3270443 commit 03ffa51

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

optional/capi/ext/struct_spec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static VALUE struct_spec_rb_struct_size(VALUE self, VALUE st) {
6262
return rb_struct_size(st);
6363
}
6464

65+
#if defined(RUBY_VERSION_IS_3_3)
6566
/* Only allow setting three attributes, should be sufficient for testing. */
6667
static VALUE struct_spec_rb_data_define(VALUE self, VALUE superclass,
6768
VALUE attr1, VALUE attr2, VALUE attr3) {
@@ -76,6 +77,7 @@ static VALUE struct_spec_rb_data_define(VALUE self, VALUE superclass,
7677

7778
return rb_data_define(superclass, a1, a2, a3, NULL);
7879
}
80+
#endif
7981

8082
void Init_struct_spec(void) {
8183
VALUE cls = rb_define_class("CApiStructSpecs", rb_cObject);
@@ -88,7 +90,9 @@ void Init_struct_spec(void) {
8890
rb_define_method(cls, "rb_struct_define_under", struct_spec_rb_struct_define_under, 5);
8991
rb_define_method(cls, "rb_struct_new", struct_spec_rb_struct_new, 4);
9092
rb_define_method(cls, "rb_struct_size", struct_spec_rb_struct_size, 1);
93+
#if defined(RUBY_VERSION_IS_3_3)
9194
rb_define_method(cls, "rb_data_define", struct_spec_rb_data_define, 4);
95+
#endif
9296
}
9397

9498
#ifdef __cplusplus

0 commit comments

Comments
 (0)