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>
Jeff King committed
Feb 20, 2013 at 15:01 UTC
e148542870013e40d02490e692818a62691c1a10
2 files changed
+13
-16
pkt-line.c
-15
@@ -46,21 +46,6 @@ static void packet_trace(const char *buf, unsigned int len, int write)
46
strbuf_release(&out);
47
}
48
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
- */
49
ssize_t safe_write(int fd, const void *buf, ssize_t n)
50
{
51
ssize_t nn = n;
pkt-line.h
+13
-1
@@ -5,7 +5,19 @@
5
#include "strbuf.h"
6
7
/*
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.
21
*/
22
void packet_flush(int fd);
23
void packet_write(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));