Re: Re* [PATCH v7 1/1] sideband: highlight keywords in remote sideband output
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 18, 2018, 16:02 UTC
- Message-ID
- <xmqqin47acir.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <xmqqmutjagc7.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
>>> - strbuf_add(dest, src, n); >>> + if (0 < n) >>> + strbuf_add(dest, src, n); >> >> This check seems unnecessary. strbuf_add can cope fine with !n. > > I was primarily interested in catching negatives, and !n was a mere > optimization, but you are correct to point out that negative n at > this point in the codeflow is a BUG().
Actually, let's just lose the conditional. strbuf_add() would catch and issue an error message when it notices that we fed negative count anyway ;-).