From: Junio C Hamano Date: Sat, 18 Aug 2018 16:02:36 GMT Subject: Re: Re* [PATCH v7 1/1] sideband: highlight keywords in remote sideband output Message-ID: In-Reply-To: Junio C Hamano writes: >>> - 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 ;-).