diff --git a/README.md b/README.md index d1ced5f..1165d3f 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ HANDLE epoll_create1(int flags); * Create a new epoll instance (port). * `size` is ignored but most be greater than zero. * `flags` must be zero as there are no supported flags. -* Returns `INVALID_HANDLE_VALUE` on failure. +* Returns `NULL` on failure. * [man page][man epoll_create] ### epoll_close diff --git a/src/api.c b/src/api.c index 5fefcc5..7f16269 100644 --- a/src/api.c +++ b/src/api.c @@ -35,8 +35,9 @@ static HANDLE _epoll_create(void) { if (reflock_tree_add(&_epoll_handle_tree, &port_info->handle_tree_node, (uintptr_t) ephnd) < 0) { + /* This should never happen. */ ep_port_delete(port_info); - return_error(INVALID_HANDLE_VALUE, ERROR_ALREADY_EXISTS); + return_error(NULL, ERROR_ALREADY_EXISTS); } return ephnd; @@ -44,14 +45,14 @@ static HANDLE _epoll_create(void) { HANDLE epoll_create(int size) { if (size <= 0) - return_error(INVALID_HANDLE_VALUE, ERROR_INVALID_PARAMETER); + return_error(NULL, ERROR_INVALID_PARAMETER); return _epoll_create(); } HANDLE epoll_create1(int flags) { if (flags != 0) - return_error(INVALID_HANDLE_VALUE, ERROR_INVALID_PARAMETER); + return_error(NULL, ERROR_INVALID_PARAMETER); return _epoll_create(); } diff --git a/test/test-auto-drop-on-close.c b/test/test-auto-drop-on-close.c index 7b3cbb2..df2a782 100644 --- a/test/test-auto-drop-on-close.c +++ b/test/test-auto-drop-on-close.c @@ -60,7 +60,7 @@ int main(void) { int r; ephnd = epoll_create1(0); - check(ephnd != INVALID_HANDLE_VALUE); + check(ephnd != NULL); sock1 = create_and_add_socket(ephnd, EPOLLIN); sock2 = create_and_add_socket(ephnd, EPOLLIN); diff --git a/test/test-multi-poll.c b/test/test-multi-poll.c index cd68472..643b982 100644 --- a/test/test-multi-poll.c +++ b/test/test-multi-poll.c @@ -107,7 +107,7 @@ int main(void) { /* Create epoll port. */ port = epoll_create1(0); - check(port != INVALID_HANDLE_VALUE); + check(port != NULL); ports[i] = port; /* Register recv_sock with the epoll port. */ diff --git a/test/test-oneshot-and-hangup.c b/test/test-oneshot-and-hangup.c index 725c080..ecf58c9 100644 --- a/test/test-oneshot-and-hangup.c +++ b/test/test-oneshot-and-hangup.c @@ -65,7 +65,7 @@ int main(void) { { /* Create an epoll instance. */ epoll_port = epoll_create(1); - check(epoll_port > 0); + check(epoll_port != NULL); } { diff --git a/test/test-udp-pings.c b/test/test-udp-pings.c index 428ed15..704e375 100644 --- a/test/test-udp-pings.c +++ b/test/test-udp-pings.c @@ -24,7 +24,7 @@ int main(void) { struct epoll_event ev; epoll_hnd = epoll_create1(0); - check(epoll_hnd && epoll_hnd != INVALID_HANDLE_VALUE); + check(epoll_hnd != NULL); srv = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); r = ioctlsocket(srv, FIONBIO, &one);