On Mon, Sep 27, 2021 at 02:54:25PM +0200, Ævar Arnfjörð Bjarmason wrote:
In C it isn't required to specify that all members of a struct are
zero'd out to 0, NULL or '\0', just providing a "{ 0 }" will
accomplish that.
Let's also change code that provided N zero'd fields to just
provide one, and change e.g. "{ NULL }" to "{ 0 }" for
consistency. I.e. even if the first member is a pointer let's use "0"
instead of "NULL". The point of using "0" consistently is to pick one,
and to not have the reader wonder why we're not using the same pattern
everywhere.
I seem to recall we've had some linter complaints about using "0" to
initialize a pointer, but I think these days it's OK, per:
- 1c96642326 (sparse: allow '{ 0 }' to be used without warnings,
2020-05-22)
and
- https://lore.kernel.org/git/18bd6127-be72-b7b7-8e2a-17bbe7214a2e@ramsayjones.plus.com/ (local)
I think this is a good step, as the long lists are unwieldy and difficult to
keep up to date without actually providing any readability or functional
value.
-Peff