]> git.ipfire.org Git - thirdparty/shadow.git/commit
src/logoutd.c: Use STRNDUPA() instead of its pattern
authorAlejandro Colomar <alx@kernel.org>
Tue, 14 May 2024 16:15:55 +0000 (18:15 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 2 Jul 2024 02:40:11 +0000 (21:40 -0500)
commitcb3e2fbdcfa3d08becf451af962d7ee95f3cd144
tree20725de0318c061d2de120f6251435f3da210cbb
parentac591763febcc05bfefb046cee38f12bb4c1e76f
src/logoutd.c: Use STRNDUPA() instead of its pattern

STRNDUPA() is equivalent to automatic storage allocation (alloca(3))
+ ZUSTR2STP().

The benefits of this refactor are:

-  The allocation size is always correct, and needs no comments, since
   it's now automatically calculated by the macro.

-  STRNDUPA() is probably more familiar, since
   -  strndupa(3) is a libc function,
   -  STRNDUPA() is the obvious wrapper that
      calculates the size based on the input array.

-  We can remove ZUSTR2STP().

Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/logoutd.c