summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-08 14:21:39 -0700
committerJunio C Hamano <gitster@pobox.com>2016-08-08 14:21:40 -0700
commit26256c017fab686c764543966bd98a45f86c6b65 (patch)
tree3bcfa6c44868067b58a2473de7f0d38b5f88977e
parent1e274ef2ba7d345f1bc469f46030f871aa348863 (diff)
parentfcf0fe9e698b7ec3de4e8565030886fc4e4a2757 (diff)
downloadgit-26256c017fab686c764543966bd98a45f86c6b65.tar.gz
Merge branch 'lf/sideband-returns-void' into maint
A small internal API cleanup. * lf/sideband-returns-void: upload-pack.c: make send_client_data() return void sideband.c: make send_sideband() return void
-rw-r--r--sideband.c4
-rw-r--r--sideband.h2
-rw-r--r--upload-pack.c19
3 files changed, 10 insertions, 15 deletions
diff --git a/sideband.c b/sideband.c
index fde8adc000..c09929dafa 100644
--- a/sideband.c
+++ b/sideband.c
@@ -124,9 +124,8 @@ int recv_sideband(const char *me, int in_stream, int out)
* fd is connected to the remote side; send the sideband data
* over multiplexed packet stream.
*/
-ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
+void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
{
- ssize_t ssz = sz;
const char *p = data;
while (sz) {
@@ -148,5 +147,4 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
p += n;
sz -= n;
}
- return ssz;
}
diff --git a/sideband.h b/sideband.h
index e46bed0b01..7a8146f161 100644
--- a/sideband.h
+++ b/sideband.h
@@ -5,6 +5,6 @@
#define SIDEBAND_REMOTE_ERROR -1
int recv_sideband(const char *me, int in_stream, int out);
-ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
+void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
#endif
diff --git a/upload-pack.c b/upload-pack.c
index f19444df7b..44d63fba41 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -58,20 +58,21 @@ static void reset_timeout(void)
alarm(timeout);
}
-static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
+static void send_client_data(int fd, const char *data, ssize_t sz)
{
- if (use_sideband)
- return send_sideband(1, fd, data, sz, use_sideband);
+ if (use_sideband) {
+ send_sideband(1, fd, data, sz, use_sideband);
+ return;
+ }
if (fd == 3)
/* emergency quit */
fd = 2;
if (fd == 2) {
/* XXX: are we happy to lose stuff here? */
xwrite(fd, data, sz);
- return sz;
+ return;
}
write_or_die(fd, data, sz);
- return sz;
}
static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
@@ -229,9 +230,7 @@ static void create_pack_file(void)
}
else
buffered = -1;
- sz = send_client_data(1, data, sz);
- if (sz < 0)
- goto fail;
+ send_client_data(1, data, sz);
}
/*
@@ -258,9 +257,7 @@ static void create_pack_file(void)
/* flush the data */
if (0 <= buffered) {
data[0] = buffered;
- sz = send_client_data(1, data, 1);
- if (sz < 0)
- goto fail;
+ send_client_data(1, data, 1);
fprintf(stderr, "flushed.\n");
}
if (use_sideband)