Merge branch 'lf/sideband-returns-void'

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
This commit is contained in:
Junio C Hamano 2016-07-06 13:38:09 -07:00
commit 35d213c87c
3 changed files with 10 additions and 15 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -62,20 +62,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)
@ -233,9 +234,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);
}
/*
@ -262,9 +261,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)