[neomutt-devel] strfcpy() improvement

Richard Russon rich at flatcap.org
Wed Oct 5 01:28:14 CEST 2016

> In fact, I would suggest turning it into a function

I didn't actually consider that.
I was just happy to eliminate 100 false positives from coverity :-)

> Most modern compilers are smart enough to inline such a trivial function.

True.  Not that anything in NeoMutt is *that* time-sensitive.

> The more macros we get rid of, the cleaner and safer the code is.

Agreed.  Plus the function could be quite simple.

The original macro ran strndup which returns a pointer to 'dest'.
There are 439 uses of strfcpy and none of them use the return value.

However, a quick bit of research shows that using a function this way
isn't considered wise, because the caller can't tell if the string has
been truncated.

I'm open to suggestions (and code)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mailman.neomutt.org/mailman/private/neomutt-devel-neomutt.org/attachments/20161005/94e61412/attachment.sig>

More information about the neomutt-devel mailing list