Skip to content

Commit

Permalink
2.6 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed May 29, 2023
1 parent 18884c4 commit b45323b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/io/console/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ console_set_winsize(VALUE io, VALUE size)
VALUE row, col, xpixel, ypixel;
const VALUE *sz;
long sizelen;
int fd;

size = rb_Array(size);
if ((sizelen = RARRAY_LEN(size)) != 2 && sizelen != 4) {
Expand All @@ -853,7 +854,7 @@ console_set_winsize(VALUE io, VALUE size)
sz = RARRAY_CONST_PTR(size);
row = sz[0], col = sz[1], xpixel = ypixel = Qnil;
if (sizelen == 4) xpixel = sz[2], ypixel = sz[3];
int fd = GetWriteFD(io);
fd = GetWriteFD(io);
#if defined TIOCSWINSZ
ws.ws_row = ws.ws_col = ws.ws_xpixel = ws.ws_ypixel = 0;
#define SET(m) ws.ws_##m = NIL_P(m) ? 0 : (unsigned short)NUM2UINT(m)
Expand Down Expand Up @@ -1399,7 +1400,7 @@ console_clear_screen(VALUE io)

#ifndef HAVE_RB_IO_OPEN_DESCRIPTOR
static VALUE
rb_io_open_descriptor(VALUE klass, int descriptor, int mode, VALUE path, VALUE timeout, rb_io_enc_t *encoding)
io_open_descriptor_fallback(VALUE klass, int descriptor, int mode, VALUE path, VALUE timeout, void *encoding)
{
rb_update_max_fd(descriptor);

Expand All @@ -1417,6 +1418,7 @@ rb_io_open_descriptor(VALUE klass, int descriptor, int mode, VALUE path, VALUE t

return self;
}
#define rb_io_open_descriptor io_open_descriptor_fallback
#endif

#ifndef HAVE_RB_IO_CLOSED_P
Expand Down

0 comments on commit b45323b

Please sign in to comment.