Skip to content

Commit 26256c0

Browse files
committed
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
2 parents 1e274ef + fcf0fe9 commit 26256c0

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

sideband.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ int recv_sideband(const char *me, int in_stream, int out)
124124
* fd is connected to the remote side; send the sideband data
125125
* over multiplexed packet stream.
126126
*/
127-
ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
127+
void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
128128
{
129-
ssize_t ssz = sz;
130129
const char *p = data;
131130

132131
while (sz) {
@@ -148,5 +147,4 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
148147
p += n;
149148
sz -= n;
150149
}
151-
return ssz;
152150
}

sideband.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#define SIDEBAND_REMOTE_ERROR -1
66

77
int recv_sideband(const char *me, int in_stream, int out);
8-
ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
8+
void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
99

1010
#endif

upload-pack.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,21 @@ static void reset_timeout(void)
5858
alarm(timeout);
5959
}
6060

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)
6262
{
63-
if (use_sideband)
64-
return send_sideband(1, fd, data, sz, use_sideband);
63+
if (use_sideband) {
64+
send_sideband(1, fd, data, sz, use_sideband);
65+
return;
66+
}
6567
if (fd == 3)
6668
/* emergency quit */
6769
fd = 2;
6870
if (fd == 2) {
6971
/* XXX: are we happy to lose stuff here? */
7072
xwrite(fd, data, sz);
71-
return sz;
73+
return;
7274
}
7375
write_or_die(fd, data, sz);
74-
return sz;
7576
}
7677

7778
static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
@@ -229,9 +230,7 @@ static void create_pack_file(void)
229230
}
230231
else
231232
buffered = -1;
232-
sz = send_client_data(1, data, sz);
233-
if (sz < 0)
234-
goto fail;
233+
send_client_data(1, data, sz);
235234
}
236235

237236
/*
@@ -258,9 +257,7 @@ static void create_pack_file(void)
258257
/* flush the data */
259258
if (0 <= buffered) {
260259
data[0] = buffered;
261-
sz = send_client_data(1, data, 1);
262-
if (sz < 0)
263-
goto fail;
260+
send_client_data(1, data, 1);
264261
fprintf(stderr, "flushed.\n");
265262
}
266263
if (use_sideband)

0 commit comments

Comments
 (0)