Re: [PATCH 1/3] pkt-line: teach packet_get_line a no-op mode

2013-02-17 Thread Jonathan Nieder
Jeff King wrote: > --- a/pkt-line.c > +++ b/pkt-line.c > @@ -234,9 +234,10 @@ int packet_get_line(struct strbuf *out, > *src_len -= 4; > len -= 4; > > - strbuf_add(out, *src_buf, len); > + if (out) > + strbuf_add(out, *src_buf, len); > + packet_trace(*src_buf,

[PATCH 1/3] pkt-line: teach packet_get_line a no-op mode

2013-02-15 Thread Jeff King
You can use packet_get_line to parse a single packet out of a stream and into a buffer. However, if you just want to throw away a set of packets from the stream, there's no need to even bother copying the bytes. This patch treats a NULL output buffer as a hint that the caller does not even want to