]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/: Use compound literals to avoid casts
authorAlejandro Colomar <alx@kernel.org>
Fri, 14 Nov 2025 01:29:16 +0000 (02:29 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 6 Dec 2025 03:22:45 +0000 (21:22 -0600)
commit9705effba5a0af3d87848bee0a434ff4c2520aef
tree8b85c59f49b241e56b4853b1d0c46767044ca7f7
parent882fbdf99b77b13207653e9b44efb5ea7083f481
lib/: Use compound literals to avoid casts

Casts are unsafe.

Compound literals also have the ability of converting values, but they
don't have the unwanted effects on safety --casts disable most useful
diagnostics--.

Compound literals are lvalues, which means their address can be taken,
and they can also be assigned to.  To avoid this, we force lvalue
conversion through a statement expression.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/alloc/calloc.h
lib/alloc/malloc.h
lib/alloc/realloc.h
lib/alloc/reallocf.h
lib/search/cmp/cmp.h
lib/search/l/lfind.h
lib/search/l/lsearch.h
lib/sizeof.h