~donmcc/ood

54b6244fed1e37f01a6d2b6e4a4c038c9440061b — Don McCaughey 2 months ago 1182412
Better names for "select set" functions.

Rename `ood_select_sets_add_errorable()` to
`ood_select_sets_check_for_error()`.

Rename `ood_select_sets_add_reader()` to
`ood_select_sets_check_for_read()`.

Rename `ood_select_sets_add_writer()` to
`ood_select_sets_check_for_write()`.
3 files changed, 15 insertions(+), 15 deletions(-)

M src/dood/server.c
M src/libood/ood/select_sets.c
M src/libood/ood/select_sets.h
M src/dood/server.c => src/dood/server.c +5 -5
@@ 47,9 47,9 @@ server_add_sockets_to_select_sets(struct server *server,
    int i = 0;
    struct ood_inet_socket *socket;
    while ((socket = ood_ptr_array_next(server->sockets, &i))) {
        if (socket->on_error) ood_select_sets_add_errorable(select_sets, socket->fd);
        if (socket->on_read) ood_select_sets_add_reader(select_sets, socket->fd);
        if (socket->on_write) ood_select_sets_add_writer(select_sets, socket->fd);
        if (socket->on_error) ood_select_sets_check_for_error(select_sets, socket->fd);
        if (socket->on_read) ood_select_sets_check_for_read(select_sets, socket->fd);
        if (socket->on_write) ood_select_sets_check_for_write(select_sets, socket->fd);
    }
}



@@ 124,11 124,11 @@ server_handle_events_in_select_sets(struct server *server,
            continue;
        }

        if (socket->on_read && ood_select_sets_is_readable(select_sets, socket->fd)) {
        if (socket->on_read && ood_select_sets_can_read(select_sets, socket->fd)) {
            socket->on_read(socket);
        }

        if (socket->on_write && ood_select_sets_is_writable(select_sets, socket->fd)) {
        if (socket->on_write && ood_select_sets_can_write(select_sets, socket->fd)) {
            socket->on_write(socket);
        }
    }

M src/libood/ood/select_sets.c => src/libood/ood/select_sets.c +5 -5
@@ 17,7 17,7 @@ ood_select_sets_clear(struct ood_select_sets *select_sets)


void
ood_select_sets_add_errorable(struct ood_select_sets *select_sets, int socket)
ood_select_sets_check_for_error(struct ood_select_sets *select_sets, int socket)
{
    select_sets->max_fd = ood_max(select_sets->max_fd, socket);
    FD_SET(socket, &select_sets->error);


@@ 25,7 25,7 @@ ood_select_sets_add_errorable(struct ood_select_sets *select_sets, int socket)


void
ood_select_sets_add_reader(struct ood_select_sets *select_sets, int socket)
ood_select_sets_check_for_read(struct ood_select_sets *select_sets, int socket)
{
    select_sets->max_fd = ood_max(select_sets->max_fd, socket);
    FD_SET(socket, &select_sets->read);


@@ 33,7 33,7 @@ ood_select_sets_add_reader(struct ood_select_sets *select_sets, int socket)


void
ood_select_sets_add_writer(struct ood_select_sets *select_sets, int socket)
ood_select_sets_check_for_write(struct ood_select_sets *select_sets, int socket)
{
    select_sets->max_fd = ood_max(select_sets->max_fd, socket);
    FD_SET(socket, &select_sets->write);


@@ 48,14 48,14 @@ ood_select_sets_has_error(struct ood_select_sets *select_sets, int socket)


bool
ood_select_sets_is_readable(struct ood_select_sets *select_sets, int socket)
ood_select_sets_can_read(struct ood_select_sets *select_sets, int socket)
{
    return FD_ISSET(socket, &select_sets->read);
}


bool
ood_select_sets_is_writable(struct ood_select_sets *select_sets, int socket)
ood_select_sets_can_write(struct ood_select_sets *select_sets, int socket)
{
    return FD_ISSET(socket, &select_sets->write);
}

M src/libood/ood/select_sets.h => src/libood/ood/select_sets.h +5 -5
@@ 20,15 20,15 @@ ood_select_sets_clear(struct ood_select_sets *select_sets);


void
ood_select_sets_add_errorable(struct ood_select_sets *select_sets, int socket);
ood_select_sets_check_for_error(struct ood_select_sets *select_sets, int socket);


void
ood_select_sets_add_reader(struct ood_select_sets *select_sets, int socket);
ood_select_sets_check_for_read(struct ood_select_sets *select_sets, int socket);


void
ood_select_sets_add_writer(struct ood_select_sets *select_sets, int socket);
ood_select_sets_check_for_write(struct ood_select_sets *select_sets, int socket);


bool


@@ 36,11 36,11 @@ ood_select_sets_has_error(struct ood_select_sets *select_sets, int socket);


bool
ood_select_sets_is_readable(struct ood_select_sets *select_sets, int socket);
ood_select_sets_can_read(struct ood_select_sets *select_sets, int socket);


bool
ood_select_sets_is_writable(struct ood_select_sets *select_sets, int socket);
ood_select_sets_can_write(struct ood_select_sets *select_sets, int socket);


enum ood_result