On Fri, May 08, 2026 at 06:08:37AM +0200, Rene Kita wrote:
> On Thu, May 07, 2026 at 12:02:08PM -0400, Derek Martin wrote:
> Why the parens around fname_starts_with_slash?
I have github Copilot making suggestions, because I wrote this on my
work laptop. TBH it's wrong about 90% of the time, but it suggested
that, and it's not wrong, so I left it.
> > + if (*fname)
> > + {
> > + mutt_buffer_addstr(d, fname);
>
> Do we really need this check? Adding an empty string should do no harm
> and would IMHO improve readability.
It does no harm but a branch wastes far fewer execution cycles than a
function call that does nothing. This was intentional, and I think
while it does add more code, it also makes the logic of the individual
cases significantly clearer... my vote would be for leaving it. And
yes, I realize it will not add significant or noticeable execution
time. That's not a good reason to waste electricity. =8^)
--
Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address. Replying to it will result in
undeliverable mail due to spam prevention. Sorry for the inconvenience.