Skip to content

Commit 402d342

Browse files
authored
Merge pull request #68 from nirs/cleanups
Minor cleanups
2 parents b981095 + d079a50 commit 402d342

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ struct state {
8989
} _state;
9090

9191
static void state_add_socket_fd(struct state *state, int socket_fd) {
92-
dispatch_semaphore_wait(state->sem, DISPATCH_TIME_FOREVER);
93-
struct conn *conn = malloc(sizeof(struct conn));
94-
memset(conn, 0, sizeof(*conn));
92+
struct conn *conn = calloc(1, sizeof(*conn));
9593
conn->socket_fd = socket_fd;
94+
dispatch_semaphore_wait(state->sem, DISPATCH_TIME_FOREVER);
9695
if (state->conns == NULL) {
9796
state->conns = conn;
9897
} else {

0 commit comments

Comments
 (0)