mbox series

[0/2] pkt-line.[ch]: dead code removal

Message ID cover-0.2-00000000000-20211014T201317Z-avarab@gmail.com (mailing list archive)
Headers show
Series pkt-line.[ch]: dead code removal | expand

Message

Ævar Arnfjörð Bjarmason Oct. 14, 2021, 8:15 p.m. UTC
Remove some dead code in pkt-line.[ch], perhaps someone has an
objection to 2/2 as we could keep that function variant around "just
in case", but it's trivial to use the underlying function (or re-add
this utility), so shedding the unused code seems better.

Ævar Arnfjörð Bjarmason (2):
  pkt-line.[ch]: remove unused packet_buf_write_len()
  pkt-line.[ch]: remove unused packet_read_line_buf()

 builtin/checkout--worker.c |  4 ++--
 daemon.c                   |  2 +-
 parallel-checkout.c        |  3 +--
 pkt-line.c                 | 45 ++++++--------------------------------
 pkt-line.h                 | 10 +--------
 remote-curl.c              |  2 +-
 6 files changed, 13 insertions(+), 53 deletions(-)

Comments

Jeff King Oct. 21, 2021, 4:30 p.m. UTC | #1
On Thu, Oct 14, 2021 at 10:15:10PM +0200, Ævar Arnfjörð Bjarmason wrote:

> Remove some dead code in pkt-line.[ch], perhaps someone has an
> objection to 2/2 as we could keep that function variant around "just
> in case", but it's trivial to use the underlying function (or re-add
> this utility), so shedding the unused code seems better.

These both look good to me.

It's perhaps a little weird to shed the now-always-NULL src arguments
from packet_read() in the second one, since the underlying function we
wrap still allows them.  But it does make the callers a little simpler,
and I think if we added any new callers that I'd much rather see them
use the struct-oriented packet_reader interface instead. Which is really
why it we can get rid of this function in the first place; it's old callers
are all using that interface.

In the long run, I'd be quite happy if could get rid of all of the
non-packet_reader calls entirely, but that's a much bigger topic. This
is a nice incremental step in that direction.

-Peff