Re: [PATCH 1/1] vreportf(): avoid buffered write in favor of unbuffered one
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 30, 2019, 01:43 UTC
- Message-ID
- <xmqqsgnb3t5l.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.1910292101300.46@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> I really believe that the care I put into the patch to safeguard against > overly long prefixes is seriously overkill.
If it was buggy, the care given to it probably was insufficient, not overkill ;-)
As long as we know there won't be an overflow, and our compilers won't complain about possible overflow, simpler code that is easier to reason about is better. I tend to think that Peff's "consistently count based on offsets, instead of pointer arithmetic that you can easily get wrong" would give us an easier-to-read result in this case.
Thanks for simplifying the original "overkill" version. Except for the bug resulting from misunderstanding of strlcpy() return value, the version I saw was a quite pleasant read.