upload-pack.c: make send_client_data() return void

The send_client_data() function uses write_or_die() for writing data which immediately terminates the process on errors. If no such error occurred, send_client_data() always returned the value that was passed as third parameter prior to this commit. This value is already known to the caller in any case, so let's turn send_client_data() into a void function instead. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lukas Fleischer committed Jun 14, 2016 at 16:49 UTC fcf0fe9e698b7ec3de4e8565030886fc4e4a2757
1 file changed +5 -10
upload-pack.c
+5 -10
@@ -58,11 +58,11 @@ static void reset_timeout(void)
58 alarm(timeout);
59 }
60
61 -static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
61 +static void send_client_data(int fd, const char *data, ssize_t sz)
62 {
63 if (use_sideband) {
64 send_sideband(1, fd, data, sz, use_sideband);
65 - return sz;
65 + return;
66 }
67 if (fd == 3)
68 /* emergency quit */
@@ -70,10 +70,9 @@ static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
70 if (fd == 2) {
71 /* XXX: are we happy to lose stuff here? */
72 xwrite(fd, data, sz);
73 - return sz;
73 + return;
74 }
75 write_or_die(fd, data, sz);
76 - return sz;
76 }
77
78 static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
@@ -231,9 +230,7 @@ static void create_pack_file(void)
230 }
231 else
232 buffered = -1;
234 - sz = send_client_data(1, data, sz);
235 - if (sz < 0)
236 - goto fail;
233 + send_client_data(1, data, sz);
234 }
235
236 /*
@@ -260,9 +257,7 @@ static void create_pack_file(void)
257 /* flush the data */
258 if (0 <= buffered) {
259 data[0] = buffered;
263 - sz = send_client_data(1, data, 1);
264 - if (sz < 0)
265 - goto fail;
260 + send_client_data(1, data, 1);
261 fprintf(stderr, "flushed.\n");
262 }
263 if (use_sideband)