From: Brandon Williams Date: Wed, 14 Mar 2018 18:31:38 +0000 (-0700) Subject: pkt-line: introduce packet_read_with_status X-Git-Tag: v2.18.0-rc0~105^2~34 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2153d478b74cfef58ee49ee0305cccf5e8a77b4f?hp=2153d478b74cfef58ee49ee0305cccf5e8a77b4f 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 Signed-off-by: Junio C Hamano ---