Skip to content

Commit

Permalink
Add explicit list types (to avoid warnings).
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 22, 2023
1 parent d2699af commit eda3b68
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 6 additions & 2 deletions ext/io/event/selector/epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ VALUE process_wait_ensure(VALUE _arguments) {
return Qnil;
}

struct IO_Event_List_Type IO_Event_Selector_EPoll_process_wait_list_type = {};

VALUE IO_Event_Selector_EPoll_process_wait(VALUE self, VALUE fiber, VALUE _pid, VALUE _flags) {
struct IO_Event_Selector_EPoll *selector = NULL;
TypedData_Get_Struct(self, struct IO_Event_Selector_EPoll, &IO_Event_Selector_EPoll_Type, selector);
Expand All @@ -489,7 +491,7 @@ VALUE IO_Event_Selector_EPoll_process_wait(VALUE self, VALUE fiber, VALUE _pid,
rb_update_max_fd(descriptor);

struct IO_Event_Selector_EPoll_Waiting waiting = {
.list = {.type = 1},
.list = {.type = &IO_Event_Selector_EPoll_process_wait_list_type},
.fiber = fiber,
.events = IO_EVENT_READABLE,
};
Expand Down Expand Up @@ -538,14 +540,16 @@ VALUE io_wait_transfer(VALUE _arguments) {
}
};

struct IO_Event_List_Type IO_Event_Selector_EPoll_io_wait_list_type = {};

VALUE IO_Event_Selector_EPoll_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE events) {
struct IO_Event_Selector_EPoll *selector = NULL;
TypedData_Get_Struct(self, struct IO_Event_Selector_EPoll, &IO_Event_Selector_EPoll_Type, selector);

int descriptor = IO_Event_Selector_io_descriptor(io);

struct IO_Event_Selector_EPoll_Waiting waiting = {
.list = {.type = 1},
.list = {.type = &IO_Event_Selector_EPoll_io_wait_list_type},
.fiber = fiber,
.events = RB_NUM2INT(events),
};
Expand Down
8 changes: 6 additions & 2 deletions ext/io/event/selector/kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,16 @@ VALUE process_wait_ensure(VALUE _arguments) {
return Qnil;
}

struct IO_Event_List_Type IO_Event_Selector_KQueue_process_wait_list_type = {};

VALUE IO_Event_Selector_KQueue_process_wait(VALUE self, VALUE fiber, VALUE _pid, VALUE _flags) {
struct IO_Event_Selector_KQueue *selector = NULL;
TypedData_Get_Struct(self, struct IO_Event_Selector_KQueue, &IO_Event_Selector_KQueue_Type, selector);

pid_t pid = NUM2PIDT(_pid);

struct IO_Event_Selector_KQueue_Waiting waiting = {
.list = {.type = 1},
.list = {.type = &IO_Event_Selector_KQueue_process_wait_list_type},
.fiber = fiber,
.events = IO_EVENT_EXIT,
};
Expand Down Expand Up @@ -536,14 +538,16 @@ VALUE io_wait_transfer(VALUE _arguments) {
}
}

struct IO_Event_List_Type IO_Event_Selector_KQueue_io_wait_list_type = {};

VALUE IO_Event_Selector_KQueue_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE events) {
struct IO_Event_Selector_KQueue *selector = NULL;
TypedData_Get_Struct(self, struct IO_Event_Selector_KQueue, &IO_Event_Selector_KQueue_Type, selector);

int descriptor = IO_Event_Selector_io_descriptor(io);

struct IO_Event_Selector_KQueue_Waiting waiting = {
.list = {.type = 1},
.list = {.type = &IO_Event_Selector_KQueue_io_wait_list_type},
.fiber = fiber,
.events = RB_NUM2INT(events),
};
Expand Down
5 changes: 4 additions & 1 deletion ext/io/event/selector/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#include <stdio.h>
#include <assert.h>

struct IO_Event_List_Type {
};

struct IO_Event_List {
struct IO_Event_List *head, *tail;
void *type;
struct IO_Event_List_Type *type;
};

inline static void IO_Event_List_initialize(struct IO_Event_List *list)
Expand Down

0 comments on commit eda3b68

Please sign in to comment.