Re: [PATCH v4 01/12] pkt-line: extract set_packet_header()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 4, 2016, 16:14 UTC
- Message-ID
- <xmqqeg645x6b.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160803211221.t2zdhvwjum2baeqs@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> The cost of write() may vary on other platforms, but the cost of memcpy > generally shouldn't. So I'm inclined to say that it is not really worth > micro-optimizing the interface. > > I think the other issue is that format_packet() only lets you send > string data via "%s", so it cannot be used for arbitrary data that may > contain NULs. So we do need _some_ other interface to let you send a raw > data packet, and it's going to look similar to the direct_packet_write() > thing.
OK. That is a much better argument than "I already stuff the length bytes in my buffer" (which will invite "How about stop doing that?") to justify a new "I have N bytes of data, send it out", whose signature would look more like write(2) and deserve to be called packet_write() but unfortunately the name is taken by what should have called packet_fmt() or something, but that squats on a good name packet_write(). Sigh.