nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] GCC 8 pre-releases have escaped...

2018-02-06 06:38:09
Hi Ken,

I'm fine with all of the changes you mentioned, Ralph, with one
caveat...  can we document them all in a header file or the source
code so we know which ones we should use under which circumstances?

Absolutely.  I'd group the alternatives together, they'd each have their
own description, like trunccpy()'s existing one, and then have an
introductory comment beforehand if needed.

    /* trunccpy copies at most size-1 chars from non-NULL src to non-NULL,
     * non-overlapping, dst, and ensures dst is NUL terminated.  If size is
     * zero then it aborts as dst cannot be NUL terminated.
     *
     * It's to be used when truncation is intended and correct, e.g.
     * reporting a possibly very long external string back to the user.  One
     * of its advantages over strncpy(3) is it doesn't pad in the common
     * case of no truncation. */
    void
    trunccpy(char *dst, const char *src, size_t size)
    {

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

-- 
Nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>