Re: [PATCH 3/4] strncat.3 fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paul,

On Mon, Nov 13, 2023 at 02:15:20AM +0100, Alejandro Colomar wrote:
> Hi Paul,
> 
> On Sun, Nov 12, 2023 at 03:52:07PM -0800, Paul Eggert wrote:
> 
> > Don't say "concatenate".
> 
> Ok
> 
> > Use "byte" instead of "character",
> 
> Ok
> 
> > and use standalone terminology rather than relying on the
> > reader already having read string_copying(7).
> 
> I need to check again in a standalone commit.
> 
> > Don't say "width" when "size" was intended.
> 
> Ok
> 
> > Fix indenting of prototype.
> 
> Ok
> 
> > Simplify possible implementation, fixing a bug when the
> > source string length and sz exceed INT_MAX.
> 
> Heh!  Good.
> 
> > Say that strncat is rarely useful.
> 
> Do we need to say that, or is it already implied by
> "append non-null bytes from a source array to a string,
>  and null-terminate the result"?
> Not many programs need to do that operation.  I'm fine with saying it's
> rarely useful; I'm just wondering if it's worth it.
> 
> > Say that behavior is undefined if the destination is not a string.
> 
> Ok
> 
> > Simplify example by using plain sizeof rather than an nitems macro,
> 
> If you want sizeof(), please use sizeof(), not sizeof.
> 
> I use nitems() with these functions because if you switch to wide
> strings, you can keep the nitems() part, while you'd have to change it
> if you had sizeof().  Also, nitems() makes it safe against sizeof(ptr).
> What do you think of this?
> 
> > by removing a confusingly-named 'maxsize' local,
> 
> Ok
> 
> > and by removing an unnecessary call to 'exit'.
> 
> This was practice from Michael Kerrisk, which I like: always terminate
> the program with exit(1); don't rely on just ending the scope of main().
> That way, it's more visual.
> 
> Please split all these things into separate patches, if you don't mind,
> and sign the patch.

I've applied a set of patches myself:

d7cdccd84 (HEAD -> contrib, alx/contrib) strncat.3: CAVEATS: Say that strncat() is rarely useful
dc2c99ffe strncat.3: CAVEATS: wfix
39209460f strncat.3: Reword description
556a2d03e strncat.3: Say that if dst isn't a string, the behavior is undefined
ec37b6ac5 strncat.3: SEE ALSO: tfix
f8de0ec01 strncat.3: EXAMPLES: Fix name of variable
1c1c9f93c strncat.3: Simplify possible implementation of strncat()
09b80aed1 strncat.3: Rename third parameter to ssize
f5429cefe strncat.3: Fix bug in possible implementation of strncat(3)
2fe3076fe strncat.3: SYNOPSIS: ffix
696152d30 strncat.3: Don't say 'width' when 'size' is intended
6fe104a7d strncat.3: Say append instead of (con)catenate

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux