Skip to content

Commit 6b3a3c3

Browse files
trinistrandrykonchin
authored andcommitted
Remove RUBY_VERSION_IS_3_3 guards from C code
Support for Ruby 3.2 was dropped in 77f1d3b and guards in Ruby were removed in 1c0dea6.
1 parent 32f4a34 commit 6b3a3c3

3 files changed

Lines changed: 0 additions & 18 deletions

File tree

optional/capi/ext/io_spec.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,21 +319,14 @@ static VALUE io_spec_errno_set(VALUE self, VALUE val) {
319319

320320
VALUE io_spec_mode_sync_flag(VALUE self, VALUE io) {
321321
int mode;
322-
#ifdef RUBY_VERSION_IS_3_3
323322
mode = rb_io_mode(io);
324-
#else
325-
rb_io_t *fp;
326-
GetOpenFile(io, fp);
327-
mode = fp->mode;
328-
#endif
329323
if (mode & FMODE_SYNC) {
330324
return Qtrue;
331325
} else {
332326
return Qfalse;
333327
}
334328
}
335329

336-
#if defined(RUBY_VERSION_IS_3_3) || defined(TRUFFLERUBY)
337330
static VALUE io_spec_rb_io_mode(VALUE self, VALUE io) {
338331
return INT2FIX(rb_io_mode(io));
339332
}
@@ -360,7 +353,6 @@ static VALUE io_spec_rb_io_open_descriptor(VALUE self, VALUE klass, VALUE descri
360353
static VALUE io_spec_rb_io_open_descriptor_without_encoding(VALUE self, VALUE klass, VALUE descriptor, VALUE mode, VALUE path, VALUE timeout) {
361354
return rb_io_open_descriptor(klass, FIX2INT(descriptor), FIX2INT(mode), path, timeout, NULL);
362355
}
363-
#endif
364356

365357
void Init_io_spec(void) {
366358
VALUE cls = rb_define_class("CApiIOSpecs", rb_cObject);
@@ -393,7 +385,6 @@ void Init_io_spec(void) {
393385
rb_define_method(cls, "rb_cloexec_open", io_spec_rb_cloexec_open, 3);
394386
rb_define_method(cls, "errno=", io_spec_errno_set, 1);
395387
rb_define_method(cls, "rb_io_mode_sync_flag", io_spec_mode_sync_flag, 1);
396-
#if defined(RUBY_VERSION_IS_3_3) || defined(TRUFFLERUBY)
397388
rb_define_method(cls, "rb_io_mode", io_spec_rb_io_mode, 1);
398389
rb_define_method(cls, "rb_io_path", io_spec_rb_io_path, 1);
399390
rb_define_method(cls, "rb_io_closed_p", io_spec_rb_io_closed_p, 1);
@@ -404,7 +395,6 @@ void Init_io_spec(void) {
404395
rb_define_const(cls, "FMODE_BINMODE", INT2FIX(FMODE_BINMODE));
405396
rb_define_const(cls, "FMODE_TEXTMODE", INT2FIX(FMODE_TEXTMODE));
406397
rb_define_const(cls, "ECONV_UNIVERSAL_NEWLINE_DECORATOR", INT2FIX(ECONV_UNIVERSAL_NEWLINE_DECORATOR));
407-
#endif
408398
}
409399

410400
#ifdef __cplusplus

optional/capi/ext/rubyspec.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,4 @@
4343
#define RUBY_VERSION_IS_3_4
4444
#endif
4545

46-
#if RUBY_VERSION_SINCE(3, 3)
47-
#define RUBY_VERSION_IS_3_3
48-
#endif
49-
5046
#endif

optional/capi/ext/struct_spec.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static VALUE struct_spec_rb_struct_initialize(VALUE self, VALUE st, VALUE values
6666
return rb_struct_initialize(st, values);
6767
}
6868

69-
#if defined(RUBY_VERSION_IS_3_3)
7069
/* Only allow setting three attributes, should be sufficient for testing. */
7170
static VALUE struct_spec_rb_data_define(VALUE self, VALUE superclass,
7271
VALUE attr1, VALUE attr2, VALUE attr3) {
@@ -81,7 +80,6 @@ static VALUE struct_spec_rb_data_define(VALUE self, VALUE superclass,
8180

8281
return rb_data_define(superclass, a1, a2, a3, NULL);
8382
}
84-
#endif
8583

8684
void Init_struct_spec(void) {
8785
VALUE cls = rb_define_class("CApiStructSpecs", rb_cObject);
@@ -95,9 +93,7 @@ void Init_struct_spec(void) {
9593
rb_define_method(cls, "rb_struct_new", struct_spec_rb_struct_new, 4);
9694
rb_define_method(cls, "rb_struct_size", struct_spec_rb_struct_size, 1);
9795
rb_define_method(cls, "rb_struct_initialize", struct_spec_rb_struct_initialize, 2);
98-
#if defined(RUBY_VERSION_IS_3_3)
9996
rb_define_method(cls, "rb_data_define", struct_spec_rb_data_define, 4);
100-
#endif
10197
}
10298

10399
#ifdef __cplusplus

0 commit comments

Comments
 (0)