Re: [PATCHv2 06/10] pkt-line: share buffer/descriptor reading implementation

2013-02-18 Thread Jonathan Nieder
Jeff King wrote: > But is it noisy about a missing pipe? We do not get EPIPE for reading. Ah, that makes more sense. [...] >>> + len = packet_read_from_buf(line, sizeof(line), &last->buf, >>> &last->len); >>> + if (len && line[len - 1] == '\n') >>> + len--;

Re: [PATCHv2 06/10] pkt-line: share buffer/descriptor reading implementation

2013-02-18 Thread Jeff King
On Mon, Feb 18, 2013 at 02:43:50AM -0800, Jonathan Nieder wrote: > Jeff King wrote: > > > The packet_read function reads from a descriptor. > > Ah, so this introduces a new analagous helper that reads from > a strbuf, to avoid the copy-from-async-procedure hack? Not from a strbuf, but basically

Re: [PATCHv2 06/10] pkt-line: share buffer/descriptor reading implementation

2013-02-18 Thread Jonathan Nieder
Jeff King wrote: > The packet_read function reads from a descriptor. Ah, so this introduces a new analagous helper that reads from a strbuf, to avoid the copy-from-async-procedure hack? [...] > --- a/pkt-line.c > +++ b/pkt-line.c > @@ -103,12 +103,26 @@ static int safe_read(int fd, void *buffer,

[PATCHv2 06/10] pkt-line: share buffer/descriptor reading implementation

2013-02-18 Thread Jeff King
The packet_read function reads from a descriptor. The packet_get_line function is similar, but reads from an in-memory buffer, and uses a completely separate implementation. This patch teaches the internal function backing packet_read to accept either source, and use the appropriate one. As a resul