Simplify net_send_all()

There is no need to declare the variable before the loop.
This commit is contained in:
Romain Vimont 2021-10-17 16:21:01 +02:00
parent 8df42cec82
commit 07d75eb336

View file

@ -116,9 +116,8 @@ net_send(socket_t socket, const void *buf, size_t len) {
ssize_t ssize_t
net_send_all(socket_t socket, const void *buf, size_t len) { net_send_all(socket_t socket, const void *buf, size_t len) {
size_t copied = 0; size_t copied = 0;
ssize_t w = 0;
while (len > 0) { while (len > 0) {
w = send(socket, buf, len, 0); ssize_t w = send(socket, buf, len, 0);
if (w == -1) { if (w == -1) {
return copied ? (ssize_t) copied : -1; return copied ? (ssize_t) copied : -1;
} }