summaryrefslogtreecommitdiff
path: root/csum-file.c
diff options
context:
space:
mode:
authorLibravatar Brandon Williams <bmwill@google.com>2018-03-14 11:31:38 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-03-14 14:15:05 -0700
commit2153d478b74cfef58ee49ee0305cccf5e8a77b4f (patch)
treeb389bd313f1de7152effc87cb4573999094eb253 /csum-file.c
parentGit 2.16-rc0 (diff)
downloadtgif-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 'csum-file.c')
0 files changed, 0 insertions, 0 deletions