stat-util: add explicit helpers for checking if stat/statx is initialized
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Mar 2024 09:23:34 +0000 (10:23 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 12 Mar 2024 09:25:48 +0000 (10:25 +0100)
commit1c248d7fb725d63a968181901e235e325413f706
treebf2d578c62ef4d2cb15309b34d5d44e47057ccb9
parent5d789ba5a6467f611d2c3d33ab256cd7056d4ab2
stat-util: add explicit helpers for checking if stat/statx is initialized

This is a follow-up for 945a8210c770801c8492eda03b6e9af3ec5d03a3 and
makes the st_dev check generic, so that we can reuse it some other
places. It also incorporates the non-NULL check now, to be a
comprehensive one-stop solution.

The helper is static inline so that compilers can optimize the redundant
checks away in case it is combined with other checks.
src/basic/stat-util.c
src/basic/stat-util.h
src/resolve/resolved-etc-hosts.c