Re: rfc: treewide scripted patch mechanism? (was: Re: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang)QUILT

From: Linus Torvalds
Date: Tue Aug 20 2019 - 20:43:49 EST


On Tue, Aug 20, 2019 at 5:20 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> Umm, btw: have you actually looked at stracpy?

Yes, Joe, I have.

What part of "there are now so many of them that no human being can
keep track of them" didn't you see as a problem?

How many broken string functions are we going to do, adding yet
another one when you notice that the _last_ one wasn't great?

We never seem to remove the broken ones. We just add yet another one,
and have a never-ending jumble of random letters.

I would seriously suggest doing something like

copy_string( dst, dstsize, src, srcsize, FLAGS );

where FLAGS migth be "pad" or whatever. Make it return the size of the
resulting string, because while it can be convenient to pass 'dst" on,
it's not useful.

And then maybe just add the helper macro that turns an array into a
"pointer, size" combination, rather than yet another letter jumble.

Linus