Skip to content

Commit 89400e0

Browse files
committed
Initialize struct read_raw_arg
1 parent 7c9dd0e commit 89400e0

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

ext/zlib/zlib.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,13 +2446,7 @@ struct gzfile {
24462446

24472447
struct read_raw_arg {
24482448
VALUE io;
2449-
union {
2450-
const VALUE argv[2]; /* for rb_funcallv */
2451-
struct {
2452-
VALUE len;
2453-
VALUE buf;
2454-
} in;
2455-
} as;
2449+
const VALUE argv[2]; /* for rb_funcallv */
24562450
};
24572451

24582452
static void
@@ -2580,9 +2574,9 @@ gzfile_read_raw_partial(VALUE arg)
25802574
{
25812575
struct read_raw_arg *ra = (struct read_raw_arg *)arg;
25822576
VALUE str;
2583-
int argc = NIL_P(ra->as.argv[1]) ? 1 : 2;
2577+
int argc = NIL_P(ra->argv[1]) ? 1 : 2;
25842578

2585-
str = rb_funcallv(ra->io, id_readpartial, argc, ra->as.argv);
2579+
str = rb_funcallv(ra->io, id_readpartial, argc, ra->argv);
25862580
Check_Type(str, T_STRING);
25872581
return str;
25882582
}
@@ -2593,8 +2587,8 @@ gzfile_read_raw_rescue(VALUE arg, VALUE _)
25932587
struct read_raw_arg *ra = (struct read_raw_arg *)arg;
25942588
VALUE str = Qnil;
25952589
if (rb_obj_is_kind_of(rb_errinfo(), rb_eNoMethodError)) {
2596-
int argc = NIL_P(ra->as.argv[1]) ? 1 : 2;
2597-
str = rb_funcallv(ra->io, id_read, argc, ra->as.argv);
2590+
int argc = NIL_P(ra->argv[1]) ? 1 : 2;
2591+
str = rb_funcallv(ra->io, id_read, argc, ra->argv);
25982592
if (!NIL_P(str)) {
25992593
Check_Type(str, T_STRING);
26002594
}
@@ -2605,11 +2599,10 @@ gzfile_read_raw_rescue(VALUE arg, VALUE _)
26052599
static VALUE
26062600
gzfile_read_raw(struct gzfile *gz, VALUE outbuf)
26072601
{
2608-
struct read_raw_arg ra;
2609-
2610-
ra.io = gz->io;
2611-
ra.as.in.len = INT2FIX(GZFILE_READ_SIZE);
2612-
ra.as.in.buf = outbuf;
2602+
struct read_raw_arg ra = {
2603+
gz->io,
2604+
{INT2FIX(GZFILE_READ_SIZE), outbuf},
2605+
};
26132606

26142607
return rb_rescue2(gzfile_read_raw_partial, (VALUE)&ra,
26152608
gzfile_read_raw_rescue, (VALUE)&ra,

0 commit comments

Comments
 (0)