Re: [PATCH v4 02/35] pkt-line: allow peeking a packet line without consuming it

2018-03-12 Thread Brandon Williams
On 03/01, Junio C Hamano wrote: > Brandon Williams writes: > > > +enum packet_read_status packet_reader_read(struct packet_reader *reader) > > +{ > > + if (reader->line_peeked) { > > + reader->line_peeked = 0; > > + return reader->status; > > + } > > +

Re: [PATCH v4 02/35] pkt-line: allow peeking a packet line without consuming it

2018-03-01 Thread Junio C Hamano
Brandon Williams writes: > +enum packet_read_status packet_reader_read(struct packet_reader *reader) > +{ > + if (reader->line_peeked) { > + reader->line_peeked = 0; > + return reader->status; > + } > + > + reader->status =

[PATCH v4 02/35] pkt-line: allow peeking a packet line without consuming it

2018-02-28 Thread Brandon Williams
Sometimes it is advantageous to be able to peek the next packet line without consuming it (e.g. to be able to determine the protocol version a server is speaking). In order to do that introduce 'struct packet_reader' which is an abstraction around the normal packet reading logic. This enables a