diff options
author | Brandon Williams <bmwill@google.com> | 2018-03-14 11:31:38 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-14 14:15:05 -0700 |
commit | 2153d478b74cfef58ee49ee0305cccf5e8a77b4f (patch) | |
tree | b389bd313f1de7152effc87cb4573999094eb253 /sub-process.h | |
parent | Git 2.16-rc0 (diff) | |
download | tgif-2153d478b74cfef58ee49ee0305cccf5e8a77b4f.tar.xz |
pkt-line: introduce packet_read_with_status
The current pkt-line API encodes the status of a pkt-line read in the
length of the read content. An error is indicated with '-1', a flush
with '0' (which can be confusing since a return value of '0' can also
indicate an empty pkt-line), and a positive integer for the length of
the read content otherwise. This doesn't leave much room for allowing
the addition of additional special packets in the future.
To solve this introduce 'packet_read_with_status()' which reads a packet
and returns the status of the read encoded as an 'enum packet_status'
type. This allows for easily identifying between special and normal
packets as well as errors. It also enables easily adding a new special
packet in the future.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sub-process.h')
0 files changed, 0 insertions, 0 deletions