]> git.ipfire.org Git - thirdparty/shadow.git/commit
xgetXXbyYY: Simplify elifs
authorAlejandro Colomar <alx@kernel.org>
Sat, 27 May 2023 01:26:52 +0000 (03:26 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 30 May 2023 18:56:55 +0000 (13:56 -0500)
commitd9f0246611aea527f21c15256a6340c618f22d73
treebeade87f5cacf394d8d9fc28ed9a7fb3af632ef3
parent89c9427087f029cad177eb8fee6884d1b218a3ab
xgetXXbyYY: Simplify elifs

-  Use SIZE_MAX rather than (size_t)-1, to improve readability.

-  Move the only branch that breaks to the first place, so that we
   remove an else.  This reduces nesting while parsing the code.

-  Now that we only have a 2-branch conditional where both branches
   assign to the same variable, rewrite it as a ternary, to shorten.

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