зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
756e676ca0
Коммит
e148542870
15
pkt-line.c
15
pkt-line.c
|
@ -46,21 +46,6 @@ static void packet_trace(const char *buf, unsigned int len, int write)
|
|||
strbuf_release(&out);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a packetized stream, where each line is preceded by
|
||||
* its length (including the header) as a 4-byte hex number.
|
||||
* A length of 'zero' means end of stream (and a length of 1-3
|
||||
* would be an error).
|
||||
*
|
||||
* This is all pretty stupid, but we use this packetized line
|
||||
* format to make a streaming format possible without ever
|
||||
* over-running the read buffers. That way we'll never read
|
||||
* into what might be the pack data (which should go to another
|
||||
* process entirely).
|
||||
*
|
||||
* The writing side could use stdio, but since the reading
|
||||
* side can't, we stay with pure read/write interfaces.
|
||||
*/
|
||||
ssize_t safe_write(int fd, const void *buf, ssize_t n)
|
||||
{
|
||||
ssize_t nn = n;
|
||||
|
|
14
pkt-line.h
14
pkt-line.h
|
@ -5,7 +5,19 @@
|
|||
#include "strbuf.h"
|
||||
|
||||
/*
|
||||
* Silly packetized line writing interface
|
||||
* Write a packetized stream, where each line is preceded by
|
||||
* its length (including the header) as a 4-byte hex number.
|
||||
* A length of 'zero' means end of stream (and a length of 1-3
|
||||
* would be an error).
|
||||
*
|
||||
* This is all pretty stupid, but we use this packetized line
|
||||
* format to make a streaming format possible without ever
|
||||
* over-running the read buffers. That way we'll never read
|
||||
* into what might be the pack data (which should go to another
|
||||
* process entirely).
|
||||
*
|
||||
* The writing side could use stdio, but since the reading
|
||||
* side can't, we stay with pure read/write interfaces.
|
||||
*/
|
||||
void packet_flush(int fd);
|
||||
void packet_write(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
|
||||
|
|
Загрузка…
Ссылка в новой задаче