Skip to content

Commit e148542

Browse files
peffgitster
authored andcommitted
pkt-line: move a misplaced comment
The comment describing the packet writing interface was originally written above packet_write, but migrated to be above safe_write in f3a3214, probably because it is meant to generally describe the packet writing interface and not a single function. Let's move it into the header file, where users of the interface are more likely to see it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 756e676 commit e148542

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

pkt-line.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,6 @@ static void packet_trace(const char *buf, unsigned int len, int write)
4646
strbuf_release(&out);
4747
}
4848

49-
/*
50-
* Write a packetized stream, where each line is preceded by
51-
* its length (including the header) as a 4-byte hex number.
52-
* A length of 'zero' means end of stream (and a length of 1-3
53-
* would be an error).
54-
*
55-
* This is all pretty stupid, but we use this packetized line
56-
* format to make a streaming format possible without ever
57-
* over-running the read buffers. That way we'll never read
58-
* into what might be the pack data (which should go to another
59-
* process entirely).
60-
*
61-
* The writing side could use stdio, but since the reading
62-
* side can't, we stay with pure read/write interfaces.
63-
*/
6449
ssize_t safe_write(int fd, const void *buf, ssize_t n)
6550
{
6651
ssize_t nn = n;

pkt-line.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55
#include "strbuf.h"
66

77
/*
8-
* Silly packetized line writing interface
8+
* Write a packetized stream, where each line is preceded by
9+
* its length (including the header) as a 4-byte hex number.
10+
* A length of 'zero' means end of stream (and a length of 1-3
11+
* would be an error).
12+
*
13+
* This is all pretty stupid, but we use this packetized line
14+
* format to make a streaming format possible without ever
15+
* over-running the read buffers. That way we'll never read
16+
* into what might be the pack data (which should go to another
17+
* process entirely).
18+
*
19+
* The writing side could use stdio, but since the reading
20+
* side can't, we stay with pure read/write interfaces.
921
*/
1022
void packet_flush(int fd);
1123
void packet_write(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));

0 commit comments

Comments
 (0)