]> git.ipfire.org Git - thirdparty/git.git/commit - pkt-line.h
pkt-line: allow peeking a packet line without consuming it
authorBrandon Williams <bmwill@google.com>
Wed, 14 Mar 2018 18:31:39 +0000 (11:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Mar 2018 21:15:06 +0000 (14:15 -0700)
commit77dabc14c497d2498b814967bf21a3ed1618207f
treecdf228f08b4093861cd8658f7691f23376e29d5f
parent2153d478b74cfef58ee49ee0305cccf5e8a77b4f
pkt-line: allow peeking a packet line without consuming it

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 caller to be able to peek a single line at a time
using 'packet_reader_peek()' and having a caller consume a line by
calling 'packet_reader_read()'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pkt-line.c
pkt-line.h