Shave off a few lines of code in src/server.c

This commit is contained in:
XANTRONIX 2020-07-03 00:04:46 -04:00 committed by XANTRONIX Industrial
parent bd68e33973
commit 619890c206

View file

@ -452,15 +452,10 @@ static int server_socket(patty_ax25_server *server,
memcpy(response.path, sock->path, sizeof(response.path));
if (write(client, &response, sizeof(response)) < 0) {
goto error_write;
}
return 0;
return write(client, &response, sizeof(response));
error_dict_set_with_hash:
error_sock_save_by_fd:
error_write:
patty_ax25_sock_destroy(sock);
error_sock_new:
@ -505,11 +500,7 @@ static int server_bind(patty_ax25_server *server,
error_invalid_status:
error_sock_by_fd:
if (write(client, &response, sizeof(response)) < 0) {
goto error_io;
}
return 0;
return write(client, &response, sizeof(response));
error_io:
return -1;
@ -546,11 +537,7 @@ static int server_listen(patty_ax25_server *server,
error_invalid_fd:
error_sock_by_fd:
if (write(client, &response, sizeof(response)) < 0) {
goto error_io;
}
return 0;
return write(client, &response, sizeof(response));
error_io:
return -1;
@ -583,11 +570,7 @@ static int server_accept(patty_ax25_server *server,
return 0;
error_sock_by_fd:
if (write(client, &response, sizeof(response)) < 0) {
goto error_io;
}
return 0;
return write(client, &response, sizeof(response));
error_save_by_addr:
error_io:
@ -710,11 +693,7 @@ error_sock_send_sabm:
error_network_down:
error_invalid_status:
error_sock_by_fd:
if (write(client, &response, sizeof(response)) < 0) {
goto error_io;
}
return 0;
return write(client, &response, sizeof(response));
error_dict_set_with_hash:
error_sock_save_by_addrpair:
@ -811,11 +790,7 @@ static int server_close(patty_ax25_server *server,
error_sock_delete:
error_sock_by_fd:
if (write(client, &response, sizeof(response)) < 0) {
goto error_io;
}
return 0;
return write(client, &response, sizeof(response));
error_io:
return -1;