Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings

From: Markus Mayer
Date: Wed Jul 13 2016 - 19:04:20 EST


On 13 July 2016 at 15:53, Luis de Bethencourt <luisbg@xxxxxxxxxxxxxxx> wrote:
>
> Hi Markus,
>
> Thank you very much for the thorough testing and solution searching.
>
> Earlier today I sent a patch that removes dynamic_debug.h from
> include/linux/kernel.h, since it isn't really needed. Sorry about this
> since it changes what you were testing just a few hours later.

I did see at least some of the changes you posted. I was mostly
curious to see where the problem was coming from in the first place.

> I am starting to think that getting access to SIZE_MAX isn't worth the
> trouble, specially considering that moving an include out of the top
> of the file makes the code less readable. The Linux kernel is growing
> in complexity and trying to keep it readable for newcomers is very
> important IMHO.

I've been thinking the same thing. It seems to be turning into a huge
effort to make this simple constant available.

> The maintainers have the last word on this, but for now I remove my
> question about why use -1 instead of SIZE_MAX.
>
> Apologies for that, the silver lining was that at least for me it was
> interesting to explore this area of the code and its inclusions. I hope
> it was for you as well.

No need to apologize. It seemed like a no-brainer to use SIZE_MAX. :-)
And I am sure all the digging will come handy in some way.

> PD: just a small comment, in case you end up sending a new version of
> your patches. In the following documentation of your functions.
> * @len: Maximum string length. May be SIZE_MAX (-1) to set no limit.
>
> What do you think about "SIZE_MAX or -1" instead of "SIZE_MAX (-1)" to
> avoid confusing any readers who might think SIZE_MAX is a function? As
> I think you intend to mean your code accepts both -1 or SIZE_MAX, which
> is ~0.
>
> Just an idea, feel free to ignore it :)

I think I might use ~(size_t)0 directly instead of -1 (or SIZE_MAX).

Thanks,
-Markus